Search code examples
asp.net-mvc-3mvvmknockout.jsestimation

Development time of ASP.NET MVC application with MVVM


We are discussing with the team different options of web application building using ASP.NET MVC. One of the options is to utilize MVVM everywhere on the rendered views (i.e. knockoutjs). Approach looks very powerful, however development effort to be considered.

I would like others to advise based on their experience (or point to some resource) some rough "industry standard" development time comparison. For example "using MVVM requires on average N times more/less effort for an average ASP.NET web app".


Solution

  • I find knockoutjs very very quick to develop with. However there are a couple of things I've found make it lots quicker.

    First thing, is to use coffeescript rather than javascript. ( using web workbench, which if you end up using, also switch to using SASS for css). However, there is no intellisense or anything for that.... though personally I don't that to be an issue. However coffeescript is a LOT more concise than javascript and marries up with knockout really nicely.

    Next thing is the transition of data from C# to json to knockout.

    typically here, in your controller, you get the data from the database (using your fav ORM), project it to a C# viewmodel, and pass it to a view ( Razor ) which then uses it and converts it to json maps it to a knockout viewmodel.

    If you move all of that into your Razor view ( basically your controller passes parameters to the view ). Then you query the database and make your C# view model in your Razor view. Then this makes development a lot faster as you can basically just edit view, refresh webpage, edit, refresh ( no compile step ).

    While this sounds a bit confusing written down, the reality of actually doing this is REALLY simple, and with tiny amounts of code you can build some pretty feature rich pages really quickly.

    depending on what you are doing, I'd say knockout based solutions tend to be 1->10 times faster. However there will be isolated cases where a particular control in asp.net make a certain thing slightly easier, however, replicating that behavior in knockout is often not that much more work, and more importantly it's way easier to customize things to be exactly what you want.