Paul is a principal consultant at ThoughtWorks. He is enthusiastic about open source in particular. He is known for Dependency Injection (one of its pioneers with PicoContainer), Selenium browser automation (co-founder), Branch by Abstraction and most recently Client-Side MVC frameworks. Paul is a DZone MVB and is not an employee of DZone and has posted 81 posts at DZone. You can read more from them at their website. View Full User Profile

The Importance of Design-Mode for Client-Side MVC

04.23.2012
| 1593 views |
  • submit to reddit

Synopsis: Design mode (the same view but without Angular or Knockout loaded) is a great way to see the multiplicity of the view as you develop.

Remember that JBehave ‘Story Navigator’ blog entry I did a year ago? Well, give it a quick click to remind yourself. It has been tidied up some since – as I get better with Angular. I forked it on github, to a version that’s published in the same way (github pages) but without JavaScript running; No AngularJS specifically.

Here’s a screenshot:

And here’s the link, which is a better way of quickly seeing the shrunken picture above.

http://paul-hammant-fork.github.com/StoryNavigator/navigator.html

Moustache or handlebar style template fields everywhere.

You can see them everywhere – things that would be output text in the final version, but are now just model references in design mode. Some are simple field references, some are more compex expressions, or have formatters attached.

Only one row versus many in the running version.

There are three rows in the running version, and only one row in the design mode.

Multiple alternates concurrently shown in design-mode

The passed OR failed icon in in the running version, is now passed AND failed (side by side) in design mode:

For each column in the table, according the the design of the JBehave StoryNavigator, there are three possibilities in respect of sort order:

  • this column is the sorted one in descending order
  • this column is the sorted one in ascending order
  • this column is not the one being sorted

All three of those realities are shown for each column, and it is that which forces the columns far out to the right of the view. There’s an obvious improvement that someone could make to that – as there is no need for me to repeat the text of the column name as it does not change.

Summary

Hopefully you get to see the beauty of of Angular and Knockout: You get to see a design preview of the finished page, with all of the components visible, and with CSS hooked up as it would be in the finished product.

Published at DZone with permission of Paul Hammant, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)