What is the purpose of durandal?
Asked Answered
C

4

9

I'm already familiar with Knockout, Angular, Sammy, jQuery, a little breeze, and a little ember. The tutorials and getting started for Durandal all seem to be saying... well first add jQuery and maybe knockout.

Does it handle something entirely different than all of these? What need does it address such that it is likely to be used with knockout?

Is it just a hodgepodge of client side routing and ui components?

What does it do on its own conceptually?

Chimb answered 24/8, 2013 at 1:19 Comment(0)
L
14

Durandal is similar to Angular in that it provides a MV* framework for client-side SPA web applications.

Angular is mostly, if not all, custom code, whereas Durandal takes existing libraries, mainly Knockout and RequireJS (Sammy dependency has been obviated with the 2.0 release), and provides the plumbing to provide full SPA functionality, including view/view model composition and hash-tag (spa) navigation.

As for Knockout, Durandal relies heavily on Knockout to compose the views and view models. Your view and view model are automatically data-bound when the view is injected into the DOM. The advantage to this is that I can use Knockout to provide the V/VM data-binding, and let Durandal do the work of figuring out which v/vm to use, retrieving it from the server, and composing it into the current screen.

Restated, Durandal provides a way to map views/view models to hash-tag based routes, which give you the SPA navigation. By specifying a shell, or layout, view as the main view, a placeholder can be added which Durandal uses to implement what is basically a "screen presenter" pattern. Durandal listens to the URL changes, and can automatically activate, data-bind (using Knockout), and display the view that matches the current URL route.

If you're familiar with WPF, you may think of Durandal as providing Prism-like functionality as its main offering, along with other goodies designed to support building single-page-applications for the web.

Lass answered 24/8, 2013 at 1:42 Comment(1)
I would say it's a lot closer to Caliburn.Micro than Prism.Electrotherapeutics
P
10

Durandal has several benefits, but also builds on existing libraries. It has a dependency on

  1. RequireJS
  2. Knockout
  3. jQuery

These are not "maybes." They are hard dependencies. Durandal cannot work without them.

At it's core, Durandal add's the very powerful compose binding to knockout. This binding will automatically locate the view (an HTML file) when passed a viewmodel, retrieve it from the server, bind it to the viewmodel, and insert them into the DOM. Similar behavior can be achieved using the knockout template binding, but managing the templates can become cumbersome. Composition also adds lifecycle events to the process, which can help ensure that viewmodels are setup and torn-down correctly. It also provides optional DOM caching.

Durandal also provides some framework structure. It provides a simple plugin API, which is used by its router to give SPA navigation via hash or push-state. It encourages the organization of viewmodels and views by overridable convention, as well as the use of Require AMD modules. It also provides a simple event module to allow application wide events to be created and consumed.

Purkey answered 24/8, 2013 at 1:55 Comment(1)
Your link goes to a sketchy website.Medardas
B
9

Durandal is a "full featured" SPA framework, whereas Knockout is just data-binding. It is similar in scope to Angular.

Bitterweed answered 24/8, 2013 at 1:45 Comment(3)
While brief, my answer is accurate and not worthy of a downvote. How about you add a correcting comment instead downvoting? (assuming you even have better answer..)Bitterweed
I haven't done any downvoting on answers here, not sure why there wwas one for you and one for tyrsiusChimb
I know bud, was some random down-voter. Wasn't directed at you.Bitterweed
J
2

Magento 2 stand on Knockout and RequireJS. Durandal can be added on top of it so more possibility come with use latest features (components, templates etc).

It is better because:

  • it is more stable and major than other framework, less errors occur

  • great documentation

  • simple api

  • more SEO friendly! (you can have all html seved and use it like component, mixed situation). Angular 2 stand on mixing logic with presentation.

  • html5 standard data and binding with better code redability (just try read html in react)

  • still maintained

  • creator of Durandal was for some time Angular Developer (3 month) so there is some similarity going on there in thinking.

  • Work in old browser ! (IE6 >)

There also cons but mainly because it don't give so much function in one pack and not newly, cutting edge technology, was adopted.

Pleas share more point about Durandal :)

More there: https://johnpapa.net/compare-durandal-to-angular-not-knockout-to-angular/

Jacquiline answered 18/5, 2017 at 20:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.