The MVC Blues

A short, techy comment (for a change).

I’m currently working on fixing a mess that somebody else made. They used all the right tools (Zend, MVC pattern etc) but then proceeded to make every possible mistake. In any given situation where a design decision was needed, they made the wrong choice.

The specific issue I’m dealing with is that I need to replace the look of the website with a new “template”. Unfortunately, the original developers didn’t stick to the MVC pattern – there’s presentation layer code in the controllers, and controller code in the html fragment files. Ugly.

So here’s the informal poll:

  • Struggle on, through wind, snow and hail, until the destination is achieved.
  • Toss the whole thing in the garbage heap and start anew.
  • Hire an international hitman to address the culprits directly.
  • Run, screaming.

I think I already know what Sol is going to say.

Disclaimer: For those without humour: the third option is intended to be mildly funny, somewhat sarcastic, and not even slightly realistic.

6 responses on “The MVC Blues

  1. Elie

    Run screaming to the hitman as you trash the entire site and start over fresh… that’s options 2 through 4.

  2. Sol

    That’s a tough one. It probably comes down to deadlines and code complexity. Usually with this thing it’s best to work with the tangle as it is, and only re-write the truly unworkable parts. It can be difficult to differentiate, though. Once the current project is done, that is a better time to consider a clean rebuilding. Assuming the client is willing to budget it. If not, it might be a good idea to warn them that their system is becoming unmaintainable and will NEED to be rewritten in the future at greater expense. Much like a car, if you don’t maintain it now, it will cost much more later.

    …what did you THINK I was going to suggest? 😛

    1. admin Post author

      Interesting article. Thanks for the link.

      I tend to use the term MVC generically for code that makes some sort of attempt to separate GUI from business logic. I started out my working life as a Smalltalk programmer though, so I know the difference.

      The code in question uses Zend’s MVC functionality in all the wrong ways. HTML output in the controllers, controller code in the templates, and even some controller code in the models (and vice versa). Blech.