Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged


Answers to this are going to be necessarily opinionated. And in your case, since as you say you don't need to worry about scaling, anything works, really. My opinion on it: prefer to expose ids in your model instead of objects. Reasoning: any part of your code can call SomeEntity.getById() if you have more complex non-CRUD type queries, like an ...


Looking at your code, if you have any requirement to have a unit test cover the processRequest method, without dependency injection it will be impossible for you to provide a mock object for MyObjectClass in your first example. If MyObjectClass interacts with anything (such as making an HTTP request, write / read from a file, save / read stuff to or from a ...


The short answer is that the form of your code sample is deceptively intuitive. It would seem that this is an "easy on the mind" way to go. Problem #1 Your Model and View objects will be tightly coupled. If you ever have to add or remove methods in the Model, then you may have to alter the View accordingly. Fundamentally, MVC is derrived from the Command ...

Top 50 recent answers are included