You know why people are so keen on MVC frameworks? Because it forces developers to separate UI, data model and business logic. Sure, I have seen people still mixing responsibilities in MVC, but I have never seen such gigantic f**kups as with ASP.NET Web Forms. I am willing to bet that if you assign random developers to Web Forms project, you will start seeing business logic, UI code and data logic all tied up in one event handler. I’ve done it for sure. I don’t have the data to prove it, but I think any developer who had something to do with Web Forms did it at least once. But why is that?

Sure, Web Forms make it easy to screw things up, but so does Windows console application project. So, that can’t be it. Personally, I think two things are at fault.

  1. People in general prefer the path of least resistance and even more so us developers.
  2. A tight deadline.

 

It is a vicious circle. Because of tight deadline, developers make just enough effort for a feature to work. And since a feature now works everyone is happy and developers move on to the next great feature. And as this usually makes developers end early, next deadline is that much shorter. And so on, until it is time to refresh the UI and you see your developers banging heads against the table.

Thus, to any developer that is willing to listen to me for 1 minute, I say: “Getting code to work does not mean your work is done.”

At my current gig (argh, again with those stories!), we have this application that every new developer went through. It is a concoction of umpteen different coding styles, little to no code separation and bad architecture. It works, no doubt about that. It is just that every little fix or upgrade takes at least a week to do. Why? Because it takes that long before you implement it so it doesn’t break some other functionality. It gets worse. Over the years, this application became a key application in the company. So when we got 3rd party software, they naturally wanted to use data from the application. “It will be simple”, they said. “It will take you a week at most”, they said. A month later the integration was finished, but it was written completely from scratch and uses exactly 0% of existing code.

Needless to say, the code would be much easier to maintain and reuse, if people got the time and know-how to make it better. They didn’t and now we are stuck with this disaster waiting to happen. Thus, believe me when I say: “Getting code to work is only half the story. The next half is making sure that other people will be able to maintain and upgrade it.”