PYTHON VS RUBY ON RAILS

Python vs Ruby on Rails

Technology has gained a fast pace with new advanced tools and languages enabling developers to build rich internet-based applications. There are various backend, or server-side languages, which help developers in many ways. But Ruby and Python are two languages that are very popular in modern web development. Many get confused while choosing the programming language for their projects, whether to go for Ruby on Rails development or Python. So in this article, let us first understand what these technologies are all about and how better they provide an edge over other frameworks.

Ruby on Rails:

Ruby on Rails is an open source web application framework and programming language that is designed for rapid development. It is observed that many web developers are switching to this for their web development procedures. As we all know Ruby is an application development programming language and Rails is the framework that the language works on, it is ideal for businesses that hold large amount of data. Ruby on Rails makes complicated websites easy to develop and in turn makes developers spend less hours in writing code.

Ruby programming language allows developers build a completely functional website within a short period. The main features of RoR is based on migrations, attractive layouts, validations, filters, helpers and view generators. Generally, most useful tools used by Ruby on Rails and other web developers are SASS, HAML, YAML, S3, EC2 and Asana etc. You have to use the ROR platform to select executing projects using J Ruby or any other type of native Ruby interpreter on your system.

Python:

In recent years, Python is widely used for faster development of high level programming language. Specifically, a working knowledge of Python can be a solid foundation because Python’s methodologies can be used in a broad range of applications. Python comes with extensive standard libraries, and has a powerful datatypes such as lists, sets and dictionaries. These really helps you to organize your data. It is taking over as the general purpose language used to demonstrate concepts, provide a common vocabulary, and to glue together systems created in other languages.

So what is it about Python that is driving its adoption?

  • Ease of Learning, Ease of Use
  • Free and Open source
  • High level language
  • Portable – All Python programs can work on any of the platforms without requiring changes.
  • Object oriented pragramming

As an object-oriented language, Python aims to encourage the creation of reusable code. Even if we write perfect documentation all the time, code can hardly be considered reusable if it’s not readable. Many of Python’s features, in addition to its use of indentation, conspire to make Python code highly readable.

Let’s look at general differences between Ruby and Python languages. The comparison given below gives a clear insight of their advantages: and disadvantages in Web application development:

python vs ruby on rails
Final Verdict:

From this comparison of Python and Ruby, it is clear that the demand of Python in the market is slightly higher. You can choose any one of them. Python and Ruby On Rails are both excellent programming languages and both are widely adopted. But among these languages about which is more powerful depends on the intended application. Both are very complete and resourceful. The learning curve of Python is relatively easy when compared to Ruby On Rails. Python has got much better support for higher order programming, functional programming and, more debateably, meta-programming. Ruby on Rails does some things better than python, as multi-threading. At the end, you should test both and make your choice.

NODE.JS FRAMEWORK COMPARISON

Node.js Framework Comparison

Express.js, Koa.js and Hapi.js are the most popular Node.js application frameworks of today and all of them have obvious similarities. Node.js frameworks enable web developers to create a server with few lines of code and creating REST API has become very simple.

Express.js

Express.js is undoubtedly the most popular Node.js application framework in contemporary web development world. Popular frameworks like Sails.js are built based on Express.js and it was described as a “fast and small server side Javascript web development framework built on node.js and V8 Javascript engine” in a web development journal. The current version of Express.js is 4.x

Express.js gained prominence as a web application framework for building single page and multi-page web apps. The finest attraction of Express.js is that many of its features are available as plug-ins and it is the backend component of MEAN stack(MongoDB ExpressJS AngularJS NodeJS). Douglas Christopher and Wilson are the developers of Express.js and it is a cross platform operating system.

Express.js can be downloaded using NPM and the command ‘npm install-g express’ in the node CLI for installing Express.JS. The quickest and easiest way to create express application architecture is to install express generator. Setting for Express applications can be obtained using the app.set and app.get methods. Application level, router level, third party and cookie middleware are available in Express.js web framework. Biggest contribution of Express.js is that it gave backend functionality that allows developers to build software with script on the server side. They can develop server side applications with Node.js and publish those ap plications as websites using Express.js.

var express = require(‘express’);
var app = express();

app.get(‘/’, function (req, res) {
res.send(‘Hello World!’);
});

var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;

console.log(‘Example app listening at http://%s:%s’, host, port);
});

” The app starts a server and listens on port 3000 for connection. It will respond with “Hello World!” for requests to the root URL (/) or route. ”

KoA.JS

Koa.js is termed as the next generation web application framework for the one and only Node.js. Objective of Koa development team was to build a smaller, expressive and robust foundation for web applications. Koa application is an object containing a wide array of middleware generator functions and they are composed in a stack like manner. Koa is almost similar to other middleware systems like Ruby’s Rack, Connect and so on. Content negotiation, cache freshness and proxy support are the spectacular features provided by Koa.js. It allows performing actions downstream, filter and then manipulating the response upstream. Methods common to all HTTP servers can be integrated directly into Koa’s small 550 SLOC database. This includes numerous functionalities like content negotiation, nominalization of node inconsistencies and redirection. Koa.js is not bundled with any middleware and it is supported in all versions of iojs without any flags. Web developers all over the world were super excited after the initial release of Koa.js and the curious fact is that Koa.js was developed by the same team who developed Express.js.

Koa is known for heavily leveraging Javascript generators provided by Harmony and Javascript generators refer to an experimental technology.

A simple hello world program in Koa.js is illustrated below.

1: var koi = require (‘koi’);
2: var app = koi ();
3:
4: app. use (function *() {
5: this. Body = ‘Hello World';
6 :});
7:
8: app. listen (3000);

We should be running node 0.11.9 or higher along with harmony flag for Javascript generator support. Koa is an innovative and pragmatic Node.js framework which can be used for building complex web applications.

HAPI.JS

Being known as a rich framework for building web applications, Hapi.js enables developers to focus on writing reusable application logic. Hapi is currently used by global corporate giants including PayPal, Walmart, Yahoo as well as Mozilla. As a web application framework, Hapi.js enables granular control over incoming requests. Hapi plug-ins can be broken into small applications with separate business logic very easily and servers should provide only configuration. In tech world, Hapi is being recognized as a battle tested framework for Node.js made by Walmart.

Hapi features huge amount of well maintained official plug-ins including OAuth. Configuration over convention approach of Hapi.js has become a hot topic of discussion among web development experts who are more inclined to convention-overconfiguration approach. Official version is that configuration based approach made the implementation of requirement theme very easy. Hapi.js will be an ideal tool for web developers who are keen on high availability, easy testing as well as easy theming.

var Hapi = require(‘hapi’);

var server = new Hapi.Server();
server.connection({ port: 3000 });

server.route({
method: ‘GET’,
path: ‘/’,
handler: function (request, reply) {
reply(‘Hello, world!’);
}
});
server.start(function () {
console.log(‘Server running at:’, server.info.uri);
});

Save the above as server.js and start the server with the command node server.js. Now, if you visit http://localhost:3000 in your browser, you’ll see the text Hello, world!.

THE OUTPUT OF THE FOLLOWING PROGRAM IS 1 4 3 2. WHY?

The output of the following program is 1 4 3 2. Why?

(function () {
console.log(1);
setTimeout(function(){console.log(2)}, 1000);
setTimeout(function(){console.log(3)}, 0);
console.log(4);
})();

Solution:
The browser has an event loop which checks the event queue and processes pending events. For example, if an event happens in the background (e.g., a script onload event) while the browser is busy (e.g., processing an onclick), the event gets appended to the queue. When the onclick handler is complete, the queue is checked and the event is then handled (e.g., the onload script is executed).
Similarly, setTimeout() also puts execution of its referenced function into the event queue if the browser is busy.
1 and 4 are displayed first since they are logged by simple calls to console.log() without any delay. 2 is displayed after 3 because 2 is being logged after a delay of 1000 msecs (i.e., 1 second) whereas 3 is being logged after a delay of 0 msecs.
When a value of zero is passed as the second argument to setTimeout(), it attempts to execute the specified function “as soon as possible”. Specifically, execution of the function is placed on the event queue to occur on the next timer tick. Note, though, that this is not immediate; the function is not executed until the next tick.
That’s why in the above example, the call to console.log(4) occurs before the call to console.log(3) (since the call to console.log(3) is invoked via setTimeout, so it is slightly delayed).

WHEN A SCOPE IS TERMINATED, EXPLAIN HOW MANY “DESTROY” EVENTS ARE FIRED?

When a scope is terminated, explain how many “destroy” events are fired?

2 Destroy events are fired when a scope is terminated.
The first one is an AngularJS event, “$destroy”, and the second one is a jqLite / jQuery event “$destroy”.
The first one can be used by AngularJS scopes where they are accessible, such as in controllers or link functions.
Consider the two below happening in a directive’s postLink function.
The AngularJS event: scope.$on(‘$destroy’, function () {
// handle the destroy, i.e. clean up.
});
And
element.on(‘$destroy’, function () {
// jQuery plugins already have this handler.
// angular.element(document.body).off(‘someCustomEvent’);
});
The jqLite / jQuery event is called whenever a node is removed, which may just happen without scope teardown.

WHY IS THE “EXPORT” KEYWORD USED TO MAKE CLASSES AND INTERFACES PUBLIC IN TYPESCRIPT?

Why is the “export” keyword used to make classes and interfaces public in Typescript?


Eg:
module some.namespace.here
{
export class SomeClass{..}
}
Is used as: varsomeVar = new some.namespace.here.SomeClass();
Solution:With the export keyword, the JavaScript adds a line to add the exported item to the module. Like in example: here.SomeClass = SomeClass;
So, visibility as controlled by public and private is just for tooling, whereas the export keyword changes the output.
In Typescript, marking a class member as public or private has no effect on the generated JavaScript. It is simple a design / compile time tool that you can use to stop your Typescript code accessing things it shouldn’t.

NODE.JS IS A SINGLE THREAD APPLICATION. DOES IT SUPPORT MULTI-PROCESS OR PLATFORMS AND UTILIZE ALL THE PROCESSOR RESOURCES?

Node.js is a single thread application. Does it support multi-process or platforms and utilize all the processor resources?


Since Node.js is by default a single thread application, it will run on a single processor core and will not take full advantage of multiple core resources.


It is believed that more performance and scalability can be achieved by doing async processing on a single thread under typical web loads than the typical thread based implementation. However, Node.js provides support for deployment on multiple-core systems, to take greater advantage of the hardware. The Cluster module is one of the core Node.js modules and it allows running multiple Node.js worker processes that will share the same port

DIFFERENCE BETWEEN EVENT.PREVENTDEFAULT() AND RETURN FALSE IN JQUERY.

Difference between event.preventDefault() and return false in jQuery.

return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.Event object.
e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return false will do both.
Note that this behavior differs from normal (non-jQuery) event handlers, in which, notably, return false does not stop the event from bubbling up.

EXT JS VS ANGULAR JS

Ext JS vs Angular JS

Ext JS and Angular JS are two industry frameworks for Rich User Interface development and both of them are regarded for powerful features. Sencha Ext JS is often considered as the industry’s most powerful Rich UI application development framework. Best features of Ext JS are cross browser compatibility, advanced MVC (Model View Controller) architecture, plug-in free charting, and modern UI widgets. Angular JS is pretty famous among web developers because of their specialties including two-way data binding, dependency injection and ability to quickly create a custom template (directives). Ext JS is often termed as one stop shop for rich User Interface applications and Angular JS does not have this distinction.

Rich collection of theme able UI components is another prominent attraction of EXT JS. There are a lot of open source components which can be integrated with Angular JS including Angular UI, Wijmo and Kendo. Major similarity of EXT JS and Angular JS is that both of them are suitable for single page applications. Cross browser compatibility is another area in which EXT JS and Angular JS possess obvious similarity. Angular JS depends on jqLite/jQuery that provides cross browser compatibility and integration with third party libraries require cross browser compatibility.

Ext JS vs Angular JS

Ext JS vs Angular JS

Similarities between Ext JS and Angular JS

Ext JS as well as Angular JS offer infinite possibilities of cross platform native mobile applications or hybrid apps. Trigger.io is optimized for Angular JS and it is used for developing rich mobile applications. How do we develop mobile sites in Ext JS and Angular JS? Sencha touch is used to develop mobile sites and Angular JS makes use of responsive modules, UI bootstrap, Angular JS response directives, and angular gestures. Built-in-router and deep linking are introduced in both Ext JS 5 and Angular JS.

Browser history, forward and backward button support are being introduced in Ext JS and it was made possible in earlier versions using Ext.util.History. Most single page app which works behind authentication may not require indexing for Search Engine Optimization. For public pages in Ext JS, it is ideal to use static HTML/CSS or AJAX based SEO. In Angular JS, it is best to consider Ajax based SEO with either Prerender.io or headless browser support in web browser. Sencha CMD tool and Sencha sdk tools are the major deployment tools available in Ext JS. Third party grunt tool, Yeoman, and Bower are the package manager functionalities available in Angular JS.

Major difference between Ext JS and Angular JS in the case of licensing is that Ext JS is open source under GPL license and it is an open script Javascript framework under MIT license. Full documentation suite, tutorials, video examples, and trainings are available for both Ext JS and Angular JS. Fascinating feature of Ext JS is that it offers no management concern of integrating new releases and bug fixes from selected 3rd party libraries. Other similar features of Ext JS and Angular JS are built-in animation support and deferred bootstrap.

  • If separate rich desktop applications and mobile web applications are valuable, it is better to choose Ext JS.
  • Business organizations who can offer paid support contracts and per seat commercial license can select Ext JS. Ext JS has become the favorite framework for many web developers as they don’t have to worry about issues of programming and development.

When to use AngularJS?

  • Companies in need of responsive design requirement and automated testing can prefer this framework over Ext JS.
  • IT organizations opting for Angular JS should be equipped with a team comfortable with CSS and who can handle cross browser compatibility issues.
  • If the web development team of an organization can’t manage integrating new releases and bug fixes from selected third party libraries throughout the application development process, they can bid adieu to Angular JS.

Final Verdict:

Ext JS has been the go-to solution for enterprises who have a very specific, long term needs. Angular JS most certainly have their place in web development. However, among these two frameworks Ext JS is component based and the code base with extending API classes as well as configuring models. Object oriented principles and MVC pattern are followed in Ext JS. Angular JS have been described as a “Model-View-Whatever’ framework in which it does not prescribe specific application architecture. Handy components delivered with Ext JS is a huge time saver and Ext JS 5 router can be used to track the application state through the use of browser history stack.