views:

75

answers:

1

Can a model depend on another model? Say I have a log model that other models want to access.

+3  A: 

If it's between models that model the same part of the domain but are intended for different purposes (you mentioned logging, others would be reporting) there should be as little coupling as possible. Not to say that there should be none.

If the models model different parts of the domain coupling should be fine. If you notice your models are overlapping you should refine your context-/model- boundaries.

Johannes Rudolph
Could you please elaborate with an example? I'm not sure I fully understand MVC terminology such as "domain". Say I have a blog with a posts model and comments model. A post might need to know how many comments there are
Znarkus
What you describe is your problem domain (blogging). In your software you'd translate this into a class model. This is your domain model.
Johannes Rudolph