-1

When developing an application using the MVC pattern, I often find myself adding a new model, a new controller, and a new set of views for the actions in the controller.

These changes are pretty atomic, as a new model is no use without changes a new controller (or at least changes to an existing controller). Similarly, I'm probably going to need some new views to make the most of my new model.

My problem is what to call this collection of things?

I've tried:

  • Module, but this implies more, um, modularity than is strictly appropriate (I'm not building anything so loosely coupled that they'd work in other systems without modification)
  • MVC triplet, which feels clumsy and glosses over the fact that the V part will expand to several things (i.e. it's not just three artefacts we've created).
  • I've toyed with words like unit and entity too, but worry that these are already tightly associated with existing concepts (testing and framework respectively).

Is there an agreed upon name for this? If not (without wanting to become opinion-based) what do you call it / hear it called?

closed as primarily opinion-based by Jörg W Mittag, Robbie Dee, gnat, Greg Burghardt, Thomas Junk Feb 24 '17 at 14:46

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It really depends on how you've structured your app... – Robbie Dee Feb 24 '17 at 9:49
  • @RobbieDee I'm not sure I follow? – Tom Wright Feb 24 '17 at 9:52
  • 1
    Why is it a problem if there isn't a name? Besides the coupling between a model and controller/view isn't that strong, you can easily use the same model for different controller/views. In some implementations there is only one controller for all model/views combinations as well. – Bent Feb 24 '17 at 10:08
  • @TomWright If you're not happy with the architectural distinction - an MVC triplet, then you're left with what that set of components denotes. That could be a subsystem, an area, a function, a leg, a feature etc etc. – Robbie Dee Feb 24 '17 at 10:23
  • @RobbieDee If "MVC triplet" is the term to use, I'll use that. I'd not come across it before elsewhere, but was toying with it as an option that I thought I'd invented! Do you have a source? Maybe you could add this as an answer? – Tom Wright Feb 24 '17 at 10:28
2

There isn't a clear name for this, primarily because there's no 1:1:1 relation between Models:Views:Controllers. Fundamentally, classic MVC is a very high-level description of the architecture. It is better to think in terms of groups of objects than in terms of individual objects, i.e. “the controllers perform operations on the model”, not necessarily “this controller class uses that model class”. After all, the model describes the entirety of the business logic. So to be utterly pedantic, a description like “the collaborating classes of this View class” or “the collaborating Controller classes of this Model class” might be best (compare also CRC cards).

Of course there are alternatives to MVC, notably MVVM or MVP. Instead of the circular (or triangular) architecture of MVC, these have a clear direction and layering and there's a clear correspondence between a view on the one hand and a presenter or view-model on the other. Here, I've sometimes heard the term axis being used to describe the group of cooperating classes for one aspect of the application. However, a single model class would not be part of the axis. Instead, the model in its entirety is one end of an axis, with the view being at the other end. While this very directional interpretation is not a good fit for the free data flow in the classic MVC pattern, using the term “axis” to describe a set of views and controllers might still be a good idea.

With the exception of “MVC triplet”, the other terms you suggested have different connotations. In particular, “entities” usually refer to domain-driven design, and “modules” would be some cohesive bundle of behaviour with a clear API such as classes or libraries. Interpreting a single MVC axis of your application as a separate library is probably not useful, though collecting the MVC axes of different bounded contexts into separate libraries might be a good idea.

  • Interestingly I appear to have dreamed up "MVC triplet" independently - I don't think I'd seen it written anywhere prior to asking this question. It seems as though it's used and understood though (see comment by Robbie Dee), so I may use it too. Axis is also worth considering - thanks. – Tom Wright Feb 24 '17 at 14:36
  • Hmm yes, if “triplets” are somewhat common, using that term might of course be better. – amon Feb 24 '17 at 16:29

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