Microsoft’s Mentality Shift: Web forms vs. MVC

In recent times, many more tech companies are stealing the spotlight these days. The likes of Apple, Google, Facebook… And somehow it seems like Microsoft’s relevance in the Tech world is diminishing.

The oppositions seem to be winning on these new tech frontiers namely Mobile, Internet, Browsers, e.t.c.. This is because even though they were the first to get on board these platforms, Microsoft as a company did not adapt quickly enough to the changes in the Landscape. It is often said that tech years are similar to dog years. This means that four years in the real world feels like ten years in the Tech World. That’s because things move at a very fast pace. Eric Schmidt once said

“The lesson to be learned over and over again in tech is that It moves and if you don’t move to it very quickly, Its very hard to get back in the race”

Eric Schmidt

However, the truth is that Microsoft as a company is changing dramatically. There is a new mentality in Microsoft and you have to be a keen observer to notice it.

This mentality shift is more apparent in some of the new Microsoft’s new technologies namely the Windows Phone 7 and Windows 8. However, this mentality shift is present in almost all their technologies.

That aside, I want to talk about this mentality shift in terms of Web development namely ASP.NET.

When ASP.NET web forms was released, many of us (myself included) were excited about it because it gave us the same event driven application model that we used for desktop applications. But as time went on, it became apparent that this approach wasn’t the best way as it easily led to really complex code and had several issues (which I mention below) and so I had to move to PHP and eventually became a “Zend Master” 😛

My problem with Microsoft is why it took them so long (roughly 7 years in real-time which would seen like 18 years in Tech) to come up with a better web-development ideology. In which time PHP has swept a good amount of Windows Programmers.

Problems with ASP.NET Web Forms

It was trying to Mimic Desktop Applications: The way a web application works and the way a desktop application works are very different. This is probably the major reason why web forms were problematic. The web is stateless and as such everything lives and dies with a single request. and to cushion that, Microsoft had to employ several strategies to maintain states e.g. placing a form to wrap the entire contents of a webpage, saving a chunk of data in a view state which made the pages and the traffic heavy, not to mention that it was unfriendly to search engines

It was trying to abstract the underlying technologies of the Web (HTML, CSS and Javascript): By using “Web Controls” that generated their own HTML, CSS and JavaScript, It seriously limited developers (like myself). The truth is they had the option to go the ASP way and script the entire website, but the platform (Visual Studio, .NET Framework) pushed you to use them. This made using you own styles or JavaScript for controls on you page to sometimes produce unexpected behavior

Page Life cycle and Tight Coupling: This is the clear consequence of Reason 1 above. Maintaining the state of an ASP.NET web application can be complex since its trying to be stateless hence the popular (Page.IsPostback) and as a result of the tight coupling, it was a bit tedious to decouple your code. Toss in Datagrid Pagination and Bindings and you have a really complicated code in minutes.

The Dawn of MVC

MVC which stands for Model-View-Controller, Is a design pattern that separates the layers of ANY application into three parts

1. The Controller – This Handles the input interface of the application. In a windows application, this would handle inputs like mouse click, keypress, e.t.c. But in a web application, this handle a URL request..

2. The Model – This handles the Data and Business logic of an application. In many web applications, we use our Database as our model and spec out our Business logic in the Database. Even though this has worked well for us, Its not an efficient approach especially when we need to make complex data manipulations.

3. The View – This handles the output of the application. In a web app. Everything that concerns the presentation of the application is done here. The CSS, Javascript, HTML e.t.c.

The MVC pattern is very important because it gives you the flexibility to swap layers and develop them independently without breaking your code.

Microsoft’s Come Back Kid: ASP.NET MVC3

Microsoft’s latest MVC framework (ASP.NET MVC3) surpasses anything I have used in the PHP world (CodeIgniter, CakePHP). C# being a strongly typed language is better for developing Business Logic than PHP. Toss in newer features of the .NET Framework like the lovely marriage between Entity Framework and LINQ (Language Integrated Query) which allows you to work with data from a database like you do with in-memory classes and objects. It goes beyond the ideas of active records found in the likes of Ruby and CodeIgniter. Another thing that is quite notable about the new Microsoft approach to Web-Application Development is the embrace of new open source technologies most notable of which is the popular JQuery. The Microsoft of 3-4 years ago would have released “MQuery” but instead they included support for JQuery and JQueryUI out of the box and even developed their own plugins for it (Jquery Tmpl and the Un-obtrusive ajax libraries).

 Home Coming

Normally I am hesitant to defend Microsoft but I think the time has come for web-developers who changed ships and some of us who shut our minds to Microsoft’s Technologies to consider a return because Microsoft has done it right this time.

To get started with ASP.NET MVC, Pluralsight has a good (and free) video tutorial series on this topic. Its worth checking out. Head over to http://asp.net/mvc for more information and tutorials

Advertisements

About Ody

Web Developer/Programmer and Hardcore Gamer. Mainly interested in the Web and Web Technologies

4 thoughts on “Microsoft’s Mentality Shift: Web forms vs. MVC

  1. Ody,
    Nice analyis. U’re logical and on point 😉
    Also, I admire your writting style 😉
    Microsoft are known for ‘automation’, they automate almost anything. In fact, having their way they would automate Steve Ballmer’s role. I really hope their technology won’t only be appealing to developers but suitable for our economic environment.
    ASP.NET are quite expensive to host, and this are one of the core reasons most people switch to the freebee,PHP!
    And for a third-world developer, it’s normally about biding,price,speed; most especially PRICE. I wish us success.

    • You can also host on Windows Azure for free. Or you can get cheap paid hosting if you want. just head over to http://asp.net/hosting Plus you get cutting edge hosting and management tools like web-deploy which does deployment with a single click from your IDE.

  2. Thanks 🙂 and Yes, you are right. In fact, I should have added it. Initially, hosting was off the roof. but now web hosting for ASP.NET is becoming alot cheaper. Many popular webhosts now put them at the same price with PHP hosting and some of them also offer free hosting (check out http://www.free-webhosts.com/)

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s