I'm just curious. If I'm a lead dev in a company of a dozens of developers is there any way I can prevent a newbie developer from creating a fat view?

By fat view I mean to have an empty controller, empty model and having all database and business logic in the view along with the html/js.

  • 13
    Catch it in the code review – Dan Pichelman Sep 30 '13 at 15:58

This isn't something particular to just MVC - it can affect any part of your system where a junior developer isn't following your team's standards and guidelines. The way to catch issues like what you describe is to have procedures in place for junior developers to learn and expand their craft while not hurting your project at the same time. This includes, as Dan mentioned in the above comment, regular code reviews of their work, but can also include ongoing learning sessions for your entire team where, say, someone can present work their recently did on a new technology that shows how or how not to use it, etc.

So that the junior developers don't feel that they are being unfairly scrutinized, the code reviews should be presented to them in a way that shows how they are for everyone's benefit:

  • The junior developer will learn coding practices they may not have been aware of.
  • The junior developer may bring new, clever ideas to the team that no one thought of before, as people often develop coding habits over time that tend to make them close-minded to new ways of thinking.
  • The team in general benefits from better communication, knowledge sharing, etc. While some may view code reviews as an impediment to getting work done, in the long run, they should save more time than they take up.

If you have an existing code base, make sure you have a few views that are "thin enough", and properly connected to their respective models and controllers. Use these as learning examples whenever a "newbie developer" joins the team. You can even write it up as a tutorial/article in a corporate standards document and put it on a wiki or something.

If they are unfamiliar with MVC, give them a link to an article that explains how you feel MVC works in your project and then show them your example code for them to see how it really works on your system. And as Dan Pichelman commented, don't let them check in anything without a code review. If someone's never coded like this, it might take them a couple of tries to get the hang of it.


Require them to create a second view, possibly as part of unit testing (the unit test suite for the controller and model could, itself, be implemented as a view).

  • 1
    What? How do you prevent them from creating a fat second view? – Robert Harvey Sep 30 '13 at 16:16
  • 1
    You fire them. Seriously, it sounds like you're looking for a technological solution to a personnel problem. – Sparr Sep 30 '13 at 16:18
  • 1
    @Sparr: That seems harsh. OP calls them "newbie developer[s]" so maybe they're fresh out of school and just don't have enough experience with this yet. – FrustratedWithFormsDesigner Sep 30 '13 at 16:20
  • @FrustratedWithFormsDesigner - at some point, they can't keep making the same mistakes over and over and expect to keep any job. They need to be put on notice and understand this is a potential consequence. The second time may be harsh. – JeffO Sep 30 '13 at 16:37
  • 1
    @JeffO: Well, yes, if it is still a problem after they have been shown the correct way to do it. If they aren't learning (despite active attempts to educate them), then they should be moved to something else that they are better at (and which adds value to the organization) or let go. – FrustratedWithFormsDesigner Sep 30 '13 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.