Skip to main content

EmberJS Vs AngularJS

Recently i was about to start another project , and we decided to use the latest tech stack , so we went with ruby 2.0 , rails 4 , mongo  2.4 but then we had to decide what javascript framework we should go with.


Personally i did not had any preference , if it was only me i would have gone with plain jquery, since the project is not UI heave and contains some complex forms with complex validations. But then i was also convinced of the fact that over the time javascript becomes very unstructured and difficult to maintain.


So we decided to do some research on which framework to choose from and why , i already knew some people who are already using angularjs in their projects and not all were happy , some even decommissioned the angular framework after working on it for couple of months.


Angular at first seems a sensible and a good choice and there was sufficient documentation for the same



Here is what i found about


Angular


Angular JS claims that it is a full blown web app framework for javascript rather than a collection of good practices.


it has its own templating system which is built as a part of the framework , so you could just combine HTML with the angular js implementation.


Angular JS has concepts of Data bindings in the templates, wherein you just put in custom angular js tags to add validation or binding it to controllers from where it reads the data.


Angular uses “Controllers” and coming from experience with MVC it turned out they’re not really controllers but more ViewModels. Each Controller handles its own specific task for example, in CRUD you’d probably have a controller for each create, read, update and delete. I believe its possible to make it have one controller but that’s a bit more advanced! 


Angular uses IOC , to inject the properties in the views which at first looks very clean and simple for simple validations ,  but as you move forward you would have to write custom tags for different validations which might be a bit tedious and could be dirty.


The whole lot of code will eventually be residing in the Controllers , which if not designed correctly may lead to a mess ( very big controller classes )



see http://egghead.io/ for a comprehensive list of videos and tutorials. 



EmberJS


Ember it seems is  a set of good design principles which have been observed over time , it is more flexible in terms of how do you want to organize your code.


Ember JS has a decent dev community , but not that extensive so we might face some difficulty if we are stuck in some special condition.


But the good thing is that Ember guys have gone really active and are continually improving the documentation.


Ember has very good core concepts , and segregation of concerns , which makes the code a good quality and more testable.


It uses Mustache/Handlebars templates for view representation , which keeps the view separated in their respective  template files.


see below for angularJS overall model , view , controller segregation.






Core Concepts -              http://emberjs.com/guides/concepts/core-concepts/



Ember in Action Video - http://www.youtube.com/watch?v=NDYW7Z24SJY  , http://www.justinappears.com/slides/ember-camp/



Ember Best Practices - https://github.com/elucid/ember-tunes/tree/master/public/js



Sample EmberJS code  - https://github.com/elucid/ember-tunes/blob/master/public/js/tunes.js 



EmberJs seems a good choice for the project , it provides the necessary structures and strict behavior so that we don’t deviate a lot from the good practices and code remains clean and testable.


The documentation which i have seen seems to be more than enough for now and is a good starting point


AngularJs on the other hand does not seem to have that model , controller , view segregation. This worries me more because we might mess up the code and make it very difficult to maintain ( which is very easy to do in javascript )

Comments

Popular posts from this blog

Fractals and Mandelbrot Set

While mathematics is in itself quite interesting and forms the basis of any modern day research, be it computational biology, machine learning or building complex structure, it can be quite a challenge to decide where to start.  That is why i decided to explore Fractals, thinking of it as a bridge between the nature and science. It brings in some really fascinating concepts which should be good enough for me as a gateway go deeper.  Fractals are in simple language never ending patterns which keep on repeating without an end, because fractals are never ending they have an infinite perimeter but finite area.  Since the patterns repeats indefinitely but if you draw a circle around the peremeter the area will remain finite.  It is like adding 1+0.1+0.01+0.001 and never making 2 This video explains the basic concept really well  Fractals are found everywhere nature in Trees, Rivers, Branching patterns, Hurricanes and Galaxies. It tries to bring order and understandin...
It was a great experience to talk to a huge audience in Mumbai and Delhi about how to start your ML journey at Google Cloud Summit ’18 India

Las Vegas

January has been pretty exciting for me since last three years, It marks my annual ritual trip to Las Vegas, this is my third trip this year. Almost all of my trips have been because of work. Since Las Vegas has some of the biggest hotels[1] in the world it has become a natural choice for some of the biggest American companies to host their internal and external conferences. As an example, CES hosts some 200,000 people every year [2]. This year I started my 30-hour flight journey, yes you heard it right I had a 9-hour layover at the London airport. Though it was far from ideal it was not that bad. If you can arrange priority pass [3] card from your credit card company or pay for it. Then you can use the lounge, showers and much more for free. I manage to steal the below picture from a hoarding at the airport.  Then after much rest and time pass at the airport terminal, I boarded my next flight to Las Vegas. When I landed McCarran International Airport, the first surprise for me was the...