2015/08/21

I don't want to go back in using webforms



It has been a great day in developing web applications and I can't express how much I'm happy and very comfortable in using MVC architecture. It made me realize to never wanna lean back in webforms ever again.

Last year when I started using MVC architecture as opposed to webforms, at first it was a challenging task for me to shift my thinking and adapt a new architecture of developing web applications. Since webforms way of firing the views is more straightforward than MVC which requires controller to invoke and render the View. At that time, I'm used in developing applications in desktop world so I concluded that webforms will be the appropriate technology for me to use so that I can utilize my existing knowledge from desktop.

But, things started to change when I tried to learn MVC more frequently.

These are the reasons why my interest shifted towards MVC:

Heavily emphasized separation of concerns code

As a developer, I'm looking for something more comfortable to use when developing web applications. It is more logical to code that has something to do within their responsibilities within the same page. Other than that, you should not be seeing some codes that is not connected to their roles. For example, if the role of that file or page is to put client-side codes there, you should only be seeing client-side codes within that file or page. But there are some instances that you have to mix client-side and server-side codes. MVC does that cleanly with the help of Razor Views. In Webforms, this was the emphasis, relying on event-driven engine based from Winforms architecture. But the way it mix them both was unbearable. At the end of the day, it depends on your comfort zone.

Html are more natural to manipulate

When I tried Webforms, it encourages me to rely on drag-and-drop objects like textbox. The problem with this was more often these controls came from server-side in order for these controls to work. As a result, you'll be relying more on server-side scripts to accomplish the interactions from client via event-driven engine based from Winforms. This has never been the case with MVC. It urges you to really learn client-side scripting such as JavaScript.

Client-side scripting can be sync with server-side scripts easily

In MVC, you get to manipulate html in client side naturally without any 'runat=server', and the controller renders the View page which makes the server and client-side scripts more separated.

Testable when you're doing some Unit Testing

Since MVC architecture is built with Separation of Concerns concept in mind, it is pretty easy to integrate Unit Testing in MVC. Of course you can do this as well with Webforms, but you still have to do some Architectural design before you can do this, some of the things to consider are MVP, and MVVM.




At the end of the day…….

It all depends on your comfort zone, specifications they've set for the team, company standards and many more. Most of the time, topics in programming are debatable and subjective depending upon the situation you are in. So I'm not telling you that you should shift your attention in using MVC just because I say so in this blog or something.

But know this: Technologies are evolving pretty fast, you need to keep up your pace if you wanted to become a great programmer.


No comments: