Tag Info

Hot answers tagged

2

It really depends on the structure of the page. If a page has only one purpose and one concern, then you should try to use a single controller so that the code is grouped logically. If there are multiple components on a page with different concerns, then you should absolutely use multiple controllers for the sake of decoupling. For example, consider a page ...


2

Like any other utility class/helper function/convenience whatever, where to put it depends on who's using it. If only M uses it, then maybe it belongs in the Model folder. If your M, V and C are all using Dates, then maybe Date belongs in a separate folder from all three. You don't have to put every piece of code in one of those three folders.


1

In MVC, the model (that is an instance of a model class) is nothing more than an ordinary object. It is initialized by the controller which passes it to MVC's engine which, in turn, uses it when generating the final result from a view. If you're asking whether it is stored on the stack or on the heap, the response is: on the heap. Instance variables for ...


1

Just some thoughts, continue to do your research on best practices. First, respect encapsulation and avoid tight coupling between views. Consider using dependency injection to inject inner views into outer views in your hierarchy - or decorating, etc. depending on the use-case. Is there a specific functional reason you want two-way chainable calling ...


1

You use a controller when you have a need to access a resource externally. So if you're building an interface to modify employee information, then you have a need for a controller there. Just because you have a resource, though, doesn't mean you need a controller for it. Suppose you have a location class/model that refers to addresses. Maybe an employee has ...



Only top voted, non community-wiki answers of a minimum length are eligible