Altabel Group's Blog

Posts Tagged ‘Node.js

 


 
Go was created in 2007 at Google as an experimental project. It was designed to be a fun language and at the same time it is productive, practical, expressive and powerful. Google Go can be considered the result of a rather conservative language evolution from languages such as C and C++.

Node.js is an increasingly popular platform that is built on fast, JavaScript-based runtime: V8. V8 is a JS virtual machine created by Google that is designed to build scalable, networked applications. It compiles JavaScript code to native machine code, using some complex optimizations. V8 also does the memory allocation and garbage collection of JS objects.

Recently, there have been criticisms about the value of using Node.js in a high-performance, networked application environment, and some developers have moved to the Go language. Not only developers but also some well-known companies, such as Google, DropBox, Docker, DigitalOcean and more have picked up Go for some of their projects.

Certainly, Node.js is still used by a much wider audience, has more modules, is easier to use and isn’t going anywhere anytime soon. However, Go is gaining more and more popularity. In this article we will take a look at the differences between Node.js and Go to reveal the strengths and weaknesses of each environment.
 
Performance

Due to JS’s dynamically-typed nature Node cannot reach the raw performance of CPU or memory bound tasks that Go can achieve in many tests. Go is about 3 times faster and more lightweight than Node.js in a production environment. Not to say that Node.js is slow, it’s fast enough for most use cases, but when you do hit a limit, Go can still go a long way.
 
Concurrency

One of the language’s peculiarities is the presence of goroutines, functions that can be executed concurrently with one another.

These can be launched simply by using a keyword. Go runtime contains a scheduler that coordinates the execution of an arbitrary number of goroutines on an arbitrary number of system threads (the M:N model). In this way it is possible to carry out rapid context switches in order to take advantage of all CPU cores. So, in a hypothetical web application written in Go a single process will be able to continue serving requests even if one of these is trying to execute a blocked operation.

Node suffers from JavaScript’s less than elegant concurrency support using the event-callback mechanism. However, for a lot of applications working with JS promises and the coming async generator support (also called “semi-coroutines”) will suffice. Something like the Koa framework is already supporting the async generator approach in Node.
 
Ease of use

Node.js is a much simpler platform to use, especially if you are already a JS developer. For Go you will need to learn some new programming concepts, such as: coroutines, channels, strict typing (with compilation), interfaces, structs, pointers, and some other differences.
 
Ecosystem

Both platforms have pretty active and growing ecosystems, but as Node.js has been around much longer and certainly it has a broader community of users and more tools that make certain software projects a lot easier and/or cheaper to implement.

Go is a younger language, however, it dynamically develops: the number of standard Go packages is growing steadily, currently at over 100, and the Go community packages can be searched easily.

In conclusion, I’d like to say that there is no ideal language/framework/tool that could be used by everyone otherwise there would be only one programming language and there wouldn’t be such debates as Go vs Node.js:) Every language is tailored to be used for specific use cases. But we need to admit that there are some things Go performs better in, at the same time it lacks some characteristics that Node.js provides.

And what advantages and disadvantages of using Node.js and Go have you come across?

 

Anna Kozik

Business Development Manager

E-mail: Anna.Kozik@altabel.com
Skype: kozik_anna
LI Profile: Anna Kozik

 

altabel

Altabel Group

Professional Software Development

E-mail: contact@altabel.com
www.altabel.com

With the coming of Node.js, JavaScript has taken the lead. It is no longer limited to front-end development, and back-end development is no longer super complex for front-end coders. It became a popular and a well-known programming language used by developers in browsers.

Today, Node.js offers one of the most innovative solutions to building servers and web/mobile applications. Its single-threaded event looping and asynchronous, non-blocking input/output processing feature distinguishes it from other runtime environments. Its scope is increasing fast with valuable contributions from developers’ community and other technology giants. Right now, several performance-driven frameworks are being developed using primary principles and approaches of Node.js. These frameworks have extended the functionality of Node.js to a great extent and have also built newer features.

In this article let’s have a look at the frameworks associated with Node.js so that you can choose the one you like.

Express.js

Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy. Express provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love. Many popular frameworks are based on Express.

Sails.js

Sails is the most popular MVC framework for Node.js. Sails makes it easy to build custom, enterprise-grade Node.js apps. It is designed to emulate the familiar MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with a scalable, service-oriented architecture. It’s especially good for building chat, real-time dashboards, or multiplayer games; but you can use it for any web application project – top to bottom.

Hapi.js

Hapi.js is a powerful Node.js web framework for building APIs and other software applications. The framework has a robust plugin system and numerous key features, including input validation, configuration-based functionality, implement caching, error handling, logging and more. Hapi.js is used for designing useful applications, such as Postmile, a collaborative list making tool. Besides, it is used for providing technology solutions by several large-scale websites, such as Disney, Concrete, PayPal, Walmart and more.

Koa.js

Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. Through leveraging generators Koa allows you to ditch callbacks and greatly increase error-handling. Koa does not bundle any middleware within core, and provides an elegant suite of methods that make writing servers fast and enjoyable.

Meteor.js

Meteor.js is a real-time application designed to build Web apps that constantly synchronize with the server. Your changes to templates and data flow from the server to the browser automatically. The redrawing and the updating are handled directly by the underlying framework. This works, by the way, in both directions. Your browser code can make changes or write data as if the database is right there. The synchronization happens in the background.

Derby.js

Derby.js is a full-stack MVC framework built for establishing a more solid routine towards creating modern web applications without the need to write complicated code. With Derby you can easily build real-time applications that will run simultaneously in the Node.js server and the browser. The Racer Engine that Derby enables for developers to use is a powerful way of synchronizing your browser, server and database data in real-time amongst all three mediums, enabling you and your app users to experience a true real-time experience. Racer supports offline usage and conflict resolution out of the box, which greatly simplifies writing multi-user applications.

Total.js

Total.js is one of the modern and modular Node.js frameworks supporting model-view controller (MVC) software architecture. It is fully compatible with various client-side frameworks, like Angular.js, Polymer, Backbone.js, Bootstrap and more. Total.js is fully extensible and asynchronous. One great feature of Total.js is that you don’t need any tools like Grunt to compress JavaScript, HTML and CSS. Additionally, the framework has NoSQL embedded database and supports array and other prototypes. It supports RESTful routing mechanism, supports web sockets, media streaming and more.

Restify

Not every application requires full support for a browser. Restify is one of the server-side frameworks designed to serve up data and only data through an API. You fire it up and out comes JSON to everyone who shows up.
Restify places special emphasis on debugging and profiling so that you can drill down and optimize the performance of your server. DTrace is well-integrated and supported to make it possible to watch what happens and when it might go wrong. Restify is available from GitHub under a very basic license that requires little except a notice of copyright.

Web and apps development landscape is changing very fast and developers are shifting to frameworks aiming at quick and clean project delivery. The biggest plus of using node frameworks is that they provide high level readymade structure and you can focus on scaling your application instead of spending efforts in building and defining the basics.

Let us know your experience with Node.js frameworks via comments. Perhaps there are any «new comers» that deserve our attention?

 

Yuliya Tolkach

Yuliya Tolkach

Business Development Manager

E-mail: Yulia.Tolkach@altabel.com
Skype: yuliya_tolkach
LI Profile: Yuliya Tolkach

 

altabel

Altabel Group

Professional Software Development

E-mail: contact@altabel.com
www.altabel.com

node.js

Node.js is an open source runtime environment which is based on Google’s V8 JavaScript engine. Many companies and frameworks had attempted to run JavaScript on the server, but Node.js was the first runtime which was good at doing it at scale.

Node.js was first written in 2009, and since then its popularity has risen immensely. The list of companies using Node.js is big enough and includes such as IBM, LinkedIn, Microsoft, PayPal, and Yahoo!. Here is the link with projects, applications, and companies using node.js https://github.com/nodejs/node-v0.x-archive/wiki/Projects,-Applications,-and-Companies-Using-Node

The node.js package manager npm became the biggest package manager in the software world in 2014, and now has almost twice as many modules as similar package managers from Java and Ruby.

Benefits

JavaScript is everywhere on the web

JavaScript won a number of browser-side languages and technologies to become the “language of the web”. Now JavaScript is on the server-side, in databases, in the internet of things, robotics and more.

Performance

There are two fundamental reasons why Node.js is quick. To begin with, it uses the Chrome V8 JavaScript engine. Second is the event loop. Node.js performs I/O non-blocking and asynchronously. As opposed to blocking parallel threads, a task is sent to the event loop with a callback and proceeds with execution. Once it finishes the async task, the callback is invoked. This approach uses less memory and it is usually simpler to program. It is likewise especially quick for I/O operations.

Npm

Npm is the package manager for Node.js and is one of the reasons for the popularity and growth of Node.js. Npm makes adding libraries and third party modules very easy, handling all of the dependencies for you. Moreover, there are about 225k modules in npm with 2.5B downloads per month.

Tools

Node.js projects range from small and simple libraries to fully blown applications. You can not only run your entire back-end on Node.js but also you can run other aspects of your engineering operations and online presence with Node.js based software. There are basic libraries like Lodash for various utility functions or Async to help with control flow in your asynchronous code. There are drivers for working with all the SQL and NOSQL databases. There are web frameworks like Express or HapiJS. There are two popular tools for build/task runners, Grunt and Gulp. For testing, there are a few great frameworks such as Mocha, Jasmine, and Lab, which includes code coverage. A great tool for managing your Node.js processes is PM2. You can run a message broker with MQTT using Mosca. If you need a continuous integration/delivery server, then there is StriderCD. You can even use HarpJS for static website generation, Ghost for blogging, and NodeBB for community forums.

A large active community

The size and usage of npm makes it clear about the size of the Node.js community. There are various resources to learn Node.js together with approximately 105k questions on StackOverfow. Most Node.js project owners are quite responsive. There are a number of blogs posts, books, open source modules, active IRC channels, several Meetup groups, conferences, and even a few consulting firms dedicated to Node.js.

When to use Node.js

Node.js is built on great non-blocking event driven architecture model. In case your project or module can really make advantage for this model, then go for it. Some of the cases could be the following:

  • Single page applications (web applications in AJAX, mobile web applications)Node.js has ability to process many requests with low response times needed. It is also able to share things like validations between client and server side, which makes it a good choice for modern web applications doing a lot of processing on client side.
  • Real time web applications:Anything that requires real-time feedback from web server such as chat application, messaging applications or other collaboration tools is good with Node.js. It will be the best technology for this type of job. Ruby and Python can do these kind of features however Node.js will do it exceptionally great in terms of performance and simplicity of development.
  • Streaming Data:In case your plan is to build streaming applications then Node.js is what you need. Traditional web technologies frequently treat http requests and responses as atomic events. However, they are streams and not events. And consequently many great Node.js applications can be built to take advantage of this fact.
  • Building APIs:Mobile applications can benefit most out of it because they consume data mostly via web services in form of JSON APIs. It’s as well perfect for taking care of many requests that are I/O driven (e.g. operations on database) and scales nicely.

When not to use Node.js:

    • Heavy CPU utilizing applications:It’s not good using Node.js for applications that are very heavy on CPU usage and very light on actual I/O. Node.js permits to easily write C++ add-ons, so you could certainly use it as a scripting engine on top of your algorithms.
    • Enterprise applications:If you’d like to build an enterprise application which requires complex operations, it’s better to stick to proven technologies like JAVA, Python. Node.js still has a long way to go and is considered to be rather young technology and yet to prove itself.
    • Simple CRUD/HTML apps:While Node.js will eventually be a tool for writing all kinds of web applications, however your application won’t mystically get more traffic just because you write it in Node.js. If large part of your application is basically rendering HTML based on some database, using Node.js will not provide a lot of business benefits yet.

Some suppose that Node.js has a big future ahead and its popularity will be rising. Do you agree with this? Which future do you predict for it? I’ll be glad to hear your thoughts in the comments below 🙂

 

Yuliya Tolkach

Yuliya Tolkach

Business Development Manager

E-mail: Yulia.Tolkach@altabel.com
Skype: yuliya_tolkach
LI Profile: Yuliya Tolkach

 

altabel

Altabel Group

Professional Software Development

E-mail: contact@altabel.com
www.altabel.com

js

JavaScript is celebrating 20th anniversary in 2015. It’s a language with a changeable history and carries a lot of baggage from its childhood, but as it leaves its teenage years behind it, now it’s a language that has finally grown up. JavaScript made a revolution in web by allowing scripts to run in a browser. But after its initial popularity soon the reputation was spoiled and JS was often associated with poorly written, cut-and-pasted code that was used to create annoying pop-ups and cheesy ‘effects’. Thus we see that JavaScript had some annoying weaknesses as a programming language.

On the other hand, we can observe that JavaScript has “ubiquity” that other programming languages don’t have. One must admit that you just need a browser to run, which means that anyone with a smartphone or computer is capable of running a JavaScript application. JavaScript has made the dream true that Java was available on all platforms by using the browser as its virtual machine. And now thanks to Node.js, it can run without a browser.

It is well known fact that simple text editor – is all you need to write a program in JS. JavaScript has a low barrier to entry when it comes to development. And we also must agree with GitHub that JavaScript is one of the most popular languages. This means that help is often easy to come by and there is a lot of JavaScript code out there. Furthermore, one should not forget that it also means that code’ libraries are well tested and many issues have already been solved.

After a first decade, which was a period of awkward childhood, JavaScript was growing up like most of the teenagers. People changed their mind with the revolutionary advent of Ajax. jQuery then made people using JavaScript to build some new applications and Node has taken it all to a whole serious level. JavaScript established itself as a powerful and flexible language with some cool features such as:
– Prototype-based Inheritance
– Closures
– JSON (subset of the object literal notation of JavaScript)
– Asynchronous event-driven programming
– Functions as objects

Frameworks and Libraries

Lots of frameworks and libraries have been written to mitigate problems and improve JavaScript for programming. JavaScript framework is the set of pre-written JavaScript code that helps to ease development of the JS based applications. This framework is also known as JavaScript libraries, which enhance the use of this programming language in many ways.
We have already shared some posts about the JavaScript frameworks in the past. JavaScript framework can be found anywhere on the web with different type of working capabilities. We have selected few of them to keep an eye on, and we hope you will find our compilation useful.

1) Angular.js

Open-source web application framework. It aims to simplify both the development and the testing of such applications by providing a framework for client-sidemodel–view–controller (MVC) and model–view–viewmodel (MVVM) architectures, along with components commonly used in rich Internet applications.

2) Ember.js

Open-source JavaScript application framework, based on the model-view-controller (MVC) pattern. It allows developers to create scalable single-page web applications by incorporating common idioms and best practices into the framework.

3) Meteor (MeteorJS)

Open-source JavaScript web application framework written using Node.js. Meteor allows for rapid prototyping and produces cross-platform (web, Android, iOS) code. It integrates with MongoDB and uses the Distributed Data Protocol and a publish–subscribe pattern to automatically propagate data changes to clients without requiring the developer to write any synchronization code. On the client, Meteor depends on jQuery and can be used with any JavaScript UI widget library.

4) Backbone.js

JavaScript library with a RESTful JSON interface and is based on the model–view–presenter (MVP) application design paradigm. Backbone is known for being lightweight, as its only dependency is on one JavaScript library, Underscore.js. It is designed for developing single-page web applications, and for keeping various parts of web applications (e.g. multiple clients and the server) synchronized. Backbone was created by Jeremy Ashkenas, who is also known for CoffeeScript.

5) Knockout.js

JavaScript implementation of the Model-View-ViewModel pattern with templates. Main principles are: a clear separation between domain data, view components and data to be displayed; the presence of a clearly defined layer of specialized code to manage the relationships between the view components. These features streamline and simplify the specification of complex relationships between view components, which in turn make the display more responsive and the user experience richer.

6) Ext JS (Sencha Ext JS)

JavaScript application for building interactive cross platform web applications using techniques such as Ajax, DHTML and DOM scripting. Ext JS includes interoperability with jQuery andPrototype.

7) D3.js (D3)

JavaScript library for producing dynamic, interactive data visualizations in web browsers. It makes use of the widely implemented SVG, HTML5, and CSS standards. It is the successor to the earlier Protovis framework. In contrast to many other libraries, D3.js allows great control over the final visual result.

Conclusion

JavaScript will be one of the most important languages to learn and invest into over the next few years. Website development is into a single-page web application that relies on JavaScript to do the heavy lifting on the client side (in this case, usually JS goes with modern front-end frameworks such as Backbone or Angular.js). The advantage of using Isomorphic JavaScript is increasing the popularity of JS. The data that is transported from databases is often stored in JSON format. The possibility of using a combination of HTML, CSS and JavaScript let you build an application for iOS, Android and FireFox OS. JavaScript has existing libraries, plugins, APIs and other cool stuff to be broad used in The Internet of Things (IoT). JavaScript is becoming the language not just for the front and back end of web development, but also for interacting with a huge number of modern devices.

To sum up, I must admit that now is the perfect time to get started with JavaScript projects, as it moves into its 20s, and has finally grown up for starting to go places!
What are your opinions about JavaScript future, its libraries and frameworks? I’d love to hear your thoughts in the comments.

 

Svetlana Pozdnyakova

Business Development Manager

 

altabel

Altabel Group

Professional Software Development

E-mail: contact@altabel.com
www.altabel.com

The competition in the server side programming department is getting tougher with each month, especially with the recent popularity of NodeJS. However let`s look how everything began.

PHP appeared about 20 years ago, in 1995 and ever since then it has been a number one language for back-end developers and has gathered a big community behind it. For a long time there wasn’t any good reason why not to use PHP: it`s rather easy to use PHP, it`s supported by the majority of hosting companies and it has become the most commonly used language in terms of number of websites powered by it.

NodeJS was created in 2009 and it was very unique to all the other back end languages. It`s an efficient and scalable software platform that can execute JavaScript code on a server. NodeJS uses event-loops rather than traditional threading, which makes it faster and less memory-intensive than traditional platforms. Thus the ability to use Javascript on both the client and the server and the ability of NodeJS to run asynchronously have undoubtedly lead to the rise of NodeJS and its popularity within developers and customers.

Of course, everyone has his own truth: one coder will praise the speed of NodeJS while the other will be devoted to the stability and long history of PHP. But let`s have a look at strong sides of both for you to decide whether to concern yourself with the so popular nowadays NodeJS or not.

PHP strong sides:

– Huge community and tons of materials for all programmers, from a beginner to an advanced coder.
– Deep code base. The most popular platforms for building websites (WordPress, Drupal, Joomla) are written in PHP. Not only are the platforms open source, but so are most of their plug-ins.
– Easy to find a hosting company. PHP has been the industry standard since the stone age and any hosting company still surviving is bound to be compatible with it. For Node.JS you still need to make a little research.
– Simplicity. PHP can be run inside of the same file as html.
– Speed of coding. For most developers, writing PHP for Web apps feels faster: no compilers, no deployment, no JAR files or preprocessors — just your favorite editor and some PHP files in a directory.
– Mixing code with content. You just open up PHP tags and start writing code. No need for templates, no need for extra files or elaborate architectures.
– No client app is needed. All of the talk about using the same language in the browser and on the server is nice, but what if you don’t need to use any language on the browser? PHP is a way out.

NodeJS strong sides:

– Speed. NodeJS is blazing fast compared to PHP. This is where Node really kicks assJ.
– Separation of Concerns. NodeJS separates fundamental components up giving a clear separation of concern across controllers / routes, models and views.
– New and fresh. It’s newer in comparison to PHP and has been developed by programmers who have full knowledge and understanding of modern web applications, from the server to the client, and that means more modern features.
– Modern syntax. Javascript isn’t perfect and it may drive developers crazy, but overall it’s a modern language that supports modern syntax such as closures, and you can easily extend Javascript and make any object configured to exactly how you need it.
– JSON. NodeJS is a powerhouse for JSON. Accessing SQL is possible and there’s plenty of plugins that make it possible, but JSON is the lingua franca for interacting with many of the latest NoSQL databases.
– Gridlock. NodeJS uses a callback structure to pass logic from one asynchronous call to the next meaning we never have to worry about spawning new threads or even considering the deadlock process. Almost no function in Node directly performs I/O, so the process never block which is a major implication for scalable systems.

That is a difficult decision when it comes up to decide which language or tool to choose. But NodeJS worth considering and it`s proved by the fact that Node is getting more and more popularity every day. And what is your opinion on NodeJS, is it the future of web?

Anna Kozik

Anna Kozik
Anna.Kozik@altabel.com 
Skype ID: kozik_anna
Business Development Manager (LI page)
Altabel Group – Professional Software Development

Within a short period of time since its initial release in late 2009, Node.js has gained the interest of thousands of experienced developers, grown a package manager and a corpus of interesting modules and applications, and even became the reason for a number of startups to appear. You may have heard about node.js, or read articles claiming how great it is; you may have even read some technically focused explanations on why it is so good.

So let’s try to understand what it is about this technology that makes it interesting to developers. And what the commercial pluses of adopting Node.js when developing and deploying web applications.

I’ve carefully look through a number of forums and experts’ opinions in these regards. Below you could find some main reason why it is worth to use Node.js.

* Node.js is a platform for writing high-performance, scalable web applications and network programs in JavaScript. It has an asynchronous, non-blocking, programming model for lightning-fast speeds and enables the use of JavaScript on the server-side so that both client and server run using the same language.

* Node.js was designed to be great at transporting small bits of information around the Internet very quickly, and in real-time. Server-side events, instant messaging apps, real-time games, and collaboration tools are all great example of this.

* Also the reason to use Node.js is based around the idea of not waiting on things. Instead of waiting for a db query to return results, it just triggers a DB query and sets a callback event. Then, while the query is processing, your program can be doing other things (like handling another request). This is what makes Node.js seem so fast.

* Node.js allows designing of scalable applications at a very high speed. The importance of scaling is going to be at a premium for all applications going forward. One of the secrets to Node’s massive scalability is the event-loop. This construct, which is fundamental to the architecture of Node, provides a completely different model for the handling of client connections than those of traditional web server technologies. The event- loop, which your Node.js applications are naturally built upon, transparently treats the connections from your clients extremely lightly. The memory usage per client is negligible, and as such a single Node.js server can handle hundreds of times more clients than a server with other languages.

* Node.js provides non-blocking libraries for database, file and network access. Since I/O is not a fundamental part of JavaScript, nothing had to be taken away to add them. Python’s Twisted and Ruby’s Event Machine have to work around some basic language components in order to get similar evented behavior.

* In addition to the performance wins Node gets “for free” by using the V8 JavaScript engine, the event loop model itself allows Node servers to handle massive concurrencies in network connections very efficiently. It often approaches the benchmarks achieved by high-performance reverse proxies like Nginx (which is also based on an event loop).

* Unlike PHP, Node.js is not “web centric”. Node.js is a general-purpose JavaScript runtime with a host of powerful libraries — one of which happens to provide an HTTP/HTTPS server implementation. With the Node.js it is easy to build command line clients and other TCP/IP servers. This could characterize Node as a quite flexible one, but at the same time, since Node.js isn’t HTTP-centric, you may find yourself having to implement code to do things once provided for you by the framework.

These are only some of the reasons I could provide and answer the question why this library gains popularity and worth to be working with.

Hope this information would be of interest and of use to you. Please feel free to share your thoughts and opinions why we would need to use Node.js. By the way how you think what to expect for it the future?

 

Natalia Osipchik

Business Development Manager

 

altabel

Altabel Group

Professional Software Development

E-mail: contact@altabel.com
www.altabel.com


%d bloggers like this: