Sunday, December 26, 2010

Moving to ASP.NET MVC

I was a long time PHP guy. So, I had grown up with a thought that PHP Language is server thing and has nothing to do with HTML. That is actually great. But in ASP.NET, that doesn’t really fits all that well. From now on, I will refer ASP.NET as ASP.NET Web Forms. Web Forms were developed keeping in mind to hide to complexity of HTTP from developer having “VB6” Windows Forms background. HTTP is stateless. Web Forms has tried hard to make HTTP state full, which brings up ViewState, Post backs and Page Life Cycle. ViewState is chunk of encoded response state data that is injected into every page so that on the next request previous state can be accessed. That was a gift for Windows Forms developers to start Web Development without actually learning the core HTTP cycle. I would also like to admit here that Web Forms is very mature, it doesn’t matter you use Drag-N-Drop approach to make pages, but you can still have full control over the output. But there are still few things that really freaks me out like ViewState Size, allow only one form tag on a page, page and control events, difficulty in client side scripting because of lack of control over HTML etc.

Well, I had work with Web Forms on few projects like DVD Store, Shopping carts, Ticket system, Appointment system, Feedback gathering system etc. At the start of every project, I fall into loop of choosing the best architecture for application. It was devastating for me. After few projects, I ended up with something like below screen capture and promise myself to strict to this.