OOP and MVC
I'm a strong believer in object oriented programming for too many reasons to enumerate here. Same for MVC, but mostly in web apps. Recently I realized that if I try to enforce OOP in an MVC framework, most of the logic moves away from the controller (C) to the model (M), since that is my main object that performs the actions. An alternative is to move this logic to helpers/utils, actions that come to help the models inside the controller, but put outside the model file (mainly because a lot of logic in the model files slows down the dev server restart).<p>I feel that something is not right in trying to mix MVC with too much OOP. Does anyone have other points of view?
3 comments
[ 2.9 ms ] story [ 14.8 ms ] threadDon't make the mistake of equating the Model with your Data Layer. They're obviously related, but not equivalent.
There are some variations on MVC where the distribution of responsibilities is different.
Most don't. I'm using Django. Recently I've started digging into iOS development (whichs rocks). I know that comparisons between the two are not fair, but I can't help wondering.
As I want to have my code easy to read and maintain, I'm trying to find the best places to put the methods, so they make sense. Any other tips are welcome.
I suppose, strictly speaking, the others -- MVP, MVVM, MVT, etc -- aren't properly called variants of MVC, but they're all aiming for philosophically similar divisions of responsibility.