Thursday 16 March 2017

Node.js pros and cons


* Node.js

Node.js is server-side platform(Not framework!) built on Google Chrome's JavaScript Engine(V8 Engine).
The definition of Node.js by official site is..

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.


Node.js is an open-source and support cross-platform environment for developing a diverse variety of server tools and application. Also, it provides a various JavaScript library which simplifies the development of web applications. Node.js are asynchronous and non-blocking library.


- Advantage of Node.js

1. Speed : Node.js is executed on Google Chrome's V8 JavaScript Engine. This engine compile directly JavaScript code into machine code. So, execution speed is fast and efficient. In addition to, the runtime environment increases significantly the execution speed by supporting non-blocking I/O operations.

2. Using a single programming language : Since Node.js consist of JavaScript language and provide JavaScript libraries, developers are able to use only one language between server-side and client-side. It brings easy and efficient development environment to deploy application. For example, developer can choose express.js or meteor.js as a backend part and backbone.js or React.js as a frontend part.

3. npm :  npm makes it easy for JavaScript developers to share and reuse code as a package. Also, it make easy to update the package. Numerous kind of package are involved in npm and it is still growing.

4. Facilitates Real-Time Application Development : Node.js is used to build real-time and multi-user applications like chats. It manages multi-user requirements through event loop. It uses websockets simplify and speedup bi-directional communication between the server and the client.


- Disadvantage of Node.js

1. Unstable Application Programming Interface : In contrast with C++ or Java, Node.js keeps changing at frequent intervals. So, sometimes, backwards-incompatible changes are occurred and made developers to change the existing code.

2. Scalability - Node.js does not provide ability to scale in order to take advantage of the multiple cores which is commonly in today's server-class hardware.

3. Node.js is not able to support CPU-intensive tasks. It is only for I/O operation.

Tuesday 7 March 2017

Week 9 - git command and starting tooltip



From the last week, I worked on creating and handling session for the close private chat. I sent pull request it but there are several comments on my pr so I am going to fix it.

I learned new command of GitHub. After sent pull request, new tasks were started without merging previous one.
New branch was created with git checkout -b new_branch 

When the new branch send pull request, the history in the new branch included the pr of closing private chat because it was not merged yet.

So, this new branch should be divided from the previous pr.

When there is no master branch in the branch list, we need to create it first.

git fetch origin
git checkout -b master upstream/master

After created master branch, start to pick the specific commit up and assign into the new branch.

git checkout -b slide-arrow-button upstream/master
git cherry-pick 1b3d5a ( this number is hashcode, you can check it on the send pull request page of GitHub)

Don't forget the test! After then, you can send pull request with new(picked) branch.


My next task is creating tooltip in React.

Tooltip is displayed string or hint which is explained when the mouse hover is occurred or the focus is on the icon, url and others.

In the css, just need to add style for some classes.





And then it works like below.






For Reactjs, we need to create new component for reusable. There are lots of plug-in related to tooltips-react, even react-bootstrap. But we are going to create new component. 



Reference : css_tooltip

Wednesday 1 March 2017

Week 8 of winter-term at CDOT and underscore.js





Due to I had terrible flu last week, I could not work well. So, I'm still working on session for closed private chats. When user1 close(remove) the chat with user2 and/or user3, these chatID are going to save in the session. Also the closed chat seems like removing from the list. The first version of code was finished to implement, but my code was so much messy, too long and it is difficult to understand for others although I wrote down comments. So I'm working on improving my code.





For the first time, I thought using flag is efficient to send information into session. So, if currently opened chat is removed(closed), flag is set to true, and this chat is going to be displayed again on the list. But, my logic was not proper because of flag so I removed and improve it by some functions in underscore.js.


Underscore.js is one of the java script library which provides useful and functional programming utility(function) to user. There is nothing to need built-in object for using it.


I'm going to improve my previous code to functional way and do another task

References : underscore.js