This pattern belongs to Object-Relational Metadata Mapping Patterns Catalog and this Catalog belongs to Patterns of Enterprise Application Architecture . Intent Repository layer is added between the domain and data mapping layers to isolate domain objects from details of the database access code and to minimize scattering and duplication of query code. The Repository pattern is especially useful in systems where a number of domain classes are large or heavy querying is utilized. Real World Examples Spring Data Applicability Use the Repository pattern when the number of domain objects is large you want to avoid duplication of query code you want to keep the database querying code in a single place you have multiple data sources Explanation A system with a complex domain model often benefits from a layer, such as the one provided by Data Mapper , that isolates domain objects from details of the database access code. In such systems, it can be worthwh...
Information Expert is the GRAS Patterns (General Responsibility Assignment Software Pattern) Read about GRASP Patterns: GRASP Patterns Overview Problem What is a general principle of assigning responsibilities to objects? A Design Model may define hundreds or thousands of software classes, and an application may require hundreds or thousands of responsibilities to be fulfilled. During object design, when the interactions between objects are defined, we make choices about the assignment of responsibilities to software classes. Done well, systems tend to be easier to understand, maintain, and extend, and there is more opportunity to reuse components in future applications. Solution Assign a responsibility to the information expert - the class that has the information necessary to fulfill the responsibility. Example Let's consider Point of Sale (POS) application: a Brief overview of POS application. Application for a shop, restaurant, etc. that registers sales. Each...
Comments
Post a Comment