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”
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
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.
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).
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.