I am aware of the Gang of Four design patterns described here: http://ift.tt/1tmzBcW
Martin Fowler talks about the Anemic Domain model (where a service layer is used and the Domain Objects contain state only i.e. no behavior. A rich Domain Model means that the Domain Objects contain state and behaviour. I have two questions:
1) Is it fair to say that the Gang of Four design patterns are targeted at rich domain models (rather than anemic) as the majority of the classes in the examples contain state and behavior?
2) Are the patterns targeted at the Business Logic Layer only? For example, consider you have an MVC5 app that has the following layers:
Presentation: MVC5
Business Logic Layer: Rich Domain Model
Data Layer: Entity Framework
In this example, the presentation layer has Model classes and the Data layer has data classes. The data classes in the Data Layer map directly to database tables. For example, a database table called person with two attributes (id and name) would result in a data class called person with two properties and two instance variables. Therefore these patterns would not apply to the Data Layer. Would they ever apply to the MVC5 (Model Layer).
Aucun commentaire:
Enregistrer un commentaire