profile

AngularJS vs. DurandalJS – part 1 of N – Where do these technologies fit?

AngularJS, DurandalJS, Single Page Applications

Here’s the deal, I like DurandalJS. Though, I’m not going to lie, I really like AngularJS as well. These two technologies compete in many respects as they both seem to tackle the same problem. What problems are these frameworks trying to tackle? I have made a diagram of what I see to be the core developments in client side technologies, and after you view this, I will talk about where I see Angular and Durandal fitting in (note that there are a myriad of other useful frameworks that do storage, pub/sub eventing, animation, data-binding, AMD pattern ala requireJS, and a slew of other things, but this represents what I believe is the focus on today’s client-side development).

State-of-JavascriptThe key elements that I focus on are DOM manipulation, routing, and MV* (model-view-controller or model-view-viewmodel, or some other variation). Although data access is very important, and many frameworks throw in an element of data access just for fullness (like Angular’s $http object), I believe that data frameworks are more often found to be separate tools, and not wrapping into, say, routing frameworks. In the world of Javascript, and client-side development, you will see frameworks popping up all the time that try to accomplish the MV* and routing scenario; and Angular and Durandal do just that. Thus, right off the bat, you should think of Angular and Durandal to accomplish the entirety of the blue and red circles above. I will get into it more later, but essentially these frameworks allow for Single Page Applications.

So what can these frameworks do exactly?

Comparisons-of-Angular-and-Durandal

The key differences between Angular and Durandal at the outset lies in the amount of inherent knowledge a dev can bring to the party. If you know Knockout and RequireJS, then Durandal will be easy to understand. If you want to learn Google’s opinion on Knockout, RequireJS, and SammyJS, then go check out Angular. I will expand on this concept in later posts, but for now, this post shows part of the world of modern Javascript and targets the patterns that these frameworks have looked to perfect.

2 Comments

  • mravinale said

    just for the record angular has:
    pub/sub -> via $broadcast(name, args)
    mvc and mvvm -> the $scope act as viewmodel , binding 2 way data and we could add functions as well, this this viewodel is in the context of the controller.
    Post, Get, Put, Delete -> via $resource

  • Ryan Keeter said

    The Pub/Sub nature with $broadcast is actually something I have only very recently heard about. I had watched and researched extensively about Angular and only recently came across it.

    Regarding $scope, I would agree that this in fact the viewmodel, but the fact that it has functions doesn't mean that it is in the context of a controller. Specifically, the function that handles the context of the application (like a home controller being called with a $scope injected on a '#/home' route) would seem to be the controller in this case. Though, I will say that the way that Angular manages viewmodels and controllers is beautiful.

    Finally, Post, Get, Put, and Delete is handled via $http at the low level and $resource at the abstracted level, so you are completely right, thank you for adding that.

Add a Comment