Monthly Archives: June 2013

Microsoft platform and web development

Microsoft, without doubt is the biggest and one of the best platform for enterprise developers . These were even more so compare to java . Visual Basic took the world by storm and everyone under the sun started writing one and have heard about the goodness, then came NGWS later became .net, seriously nobody could write a better language than c# team did. But the advent of mobile and better browser supports means a lot of Microsoft development shop spending their time and effort on building up and front end , and those who adopted basic of the web) were all the rage with server controls and event, I was there, preaching about the goodness… Until one day.. And it happened to a lot people .. Ajax… JavaScript, why do we have to do everything on the server,…. And the classic case was there was this team of developers who claims … They are the new generation of web developers, know not a single line of HTML and JavaScript other alert. Oh well .. When jQuery was released to the world… They were all still sleeping and think it was some kind of stupid.. Php, un-object oriented, uncool stuff.

What they don’t realized or they just ignoring them is the fact that JavaScript is no longer , something that you slap in at the end of the day just to make that bit or this bit a little nicer, people have been developing in JavaScript from end to end, and they are still pre-occupied with,  “One”… who cares(well may be those VB6 programmers who just heard about Entity framework and Web API are among the few things I will never allow my team to ever touch or learn, WHY would I need somebody to write me code that we don’t understand. EF makes it harder to apply SOLID principals in every way.

For the rest of us, we at Bespoke have been for at least 5/6 years , never have to do anything server control or Html.LabelFor or Html.EditorFor.. any more, if we want a label then we will write <label> this is my label</label>.


With the announcement of internet explorer 11, Microsoft finally has something to o against Chrome DevTools and FireBug except..

  • it’s too late – see what happen to Windows Phone
  • it doesn’t work everywhere  – it’s not like Chrome or Firebug

Is it really important, for the F12 to work every where, every one has their own opinion, but  in Microsoft case, they only care about their latest OS. If they intend to get really serious about winning developers mind and hard they get work harder.

I personally believed that a good developers tools should no be bundled from the main branch of the browser, what they should do is have a developer edition of the browser that come with very powerful tools for developers. May be based on Visual Studio shell, heck who cares if its 500MB, it’s only meant for developers and they won’t install it on their iPad/ table anyway.

These are the list of features they should have.

  • It’s completely blind to the server technology
  • Support for TypeScript debugging, (the only reason I write JavaScripts instead of TypeScript is debugging in codes that you don’t write is stupid)
  • Having workspaces and assets and version control built in(do a local Git repository) allowing us to do branching and experiment
  • Lots of override and emulation for touch, GelLocation , HTML5 platform and so forth

The closest i could get to this thing today is combination of Chrome DevTools and JetBrains WebStorm, with all the mock and requirejs, I hardly back in Visual Studio anymore.










DurandalJS with server side code

Those of you that do everything on the client side when using SPA framework are often writing a more complex code in order to cater for something such as authorization, and security related code. Writing these code on the client is often very tedious and error prone, not to mention that once everything gets in the browser , someone could always find a way to beat you.

It’s the best to control access on the server, but what if your views and view models are all .js files and .html files in ~/App/Views and ~/App/ViewModels directory, there’s going to be a lot of <location> tag in your web.config

The best way is always to do in using ASP.Net MVC controller and action and spit out these js and html accordingly and being able to use C# and Razor on the server.

DurandalJs default configuration is set to look for views and viewmodels in the default location in ~/App/Views/m.html and the view model in ~/App/ViewModels/<m>.js, and if the server find a disk file there, it will fetch it, but what is it’s not there. Well then the default router will try to find a controller with name AppController , and ViewModels action in it, your m.js will become the id parameter. So you could write this controller and the action for Views, ViewModels, config and what ever that’s directly under the ~/App folder.

 public partial class AppController

        public ActionResult ConfigJs()
            return View();

        public ActionResult Config(string id)
            this.Response.ContentType = APPLICATION_JAVASCRIPT;
            var script = this.RenderScript("ConfigJs");
            return Content(script);


If you delete your config.js file then automatically this action will be executed and will render your ConfigJs view, where you could use server side C# and Razor to customize the output.

See, you can’t find config.js , neither is something.js in viewmodels or something.html in views

and yet the server responded well and DurandalJs didn’t care

Get the plumbings at