Hello, another_coder, you wrote: _> Hello, Baudolino. _> Now, such determination, in my opinion, misleads people since is too the general. Behind this determination any functional, any can disappear. Any, satisfying to pattern determination. It is a normal situation. _> and the resulted example, really, satisfies. But it not a repository. It is a repository on determination. And on standard enough determination. If you want to make other determination, give, but you will need to explain, than it is better. B>> I.e. any repository - DAO, but not any DAO - a repository. _> Because of such representation also there is a confusion in dialogue. The confusion in dialogue normally arises that someone something does not know or does not understand. Normally dares a phrase "give to begin with we define that the such..." And a glossary in the architectural documentation. _> I think, it is necessary to divide flies from cutlets: DAO - abstraction over storage to the data, without logic connected to business, Repository - it is similar, as aggregate root in DDD. You suggest to separate flies from cutlets, but use words "similarly" and "as". Good determination should not use analogy because determination by analogy is unsharp: it is necessary on mental model of the reader which at different people can be different. Make accurate determination in Russian and we consider it. _> it is mixed nothing. Look and try to think, where you it will reduce all in uniform system? B>> the logic of implementation of "requests" _> Is pure DAO, or ORM framework. What is "pure DAO"? That means in this case "or": if it ORM, it not DAO? Or DAO=ORM? How from it repository determination changes? B>> caching and - singularities of internal implementation about which the client does not know. _> it is the service logic which can change it is not dependent on storage on not dependent on designing and a software either the client, or . At what level it will be used? What is "the service logic"? Auxiliary? Logic of a service layer? Caching is algorithmic, instead of an architectural pattern. As your component of access to a DB is implemented is the latent detail of implementation. The repository can cache, the DB gateway - can, the client of a layer of data access - can. The essence of determinations from it does not change. B>> a filtration on the auxiliary fields - interface DAO part (and as it is told above, maybe, a repository) _> the Auxiliary fields to the auxiliary fields . There are that are a part logic business, there are those, a part of integrity of data storage, and are that are necessary within the limits of system maintenance. Where concerns, for example, IsDeleted (means, what is deleted nothing), and where a filtration on CreatedDate (means not to show too old)? It is specificity of the functional requirements to specific system which need to be analyzed properly. Let's disassemble on example IsDeleted. In itself such field never appears - it is a part of requirements to an application infrastructure, to that as specific entities are processed given generally, instead of. As a rule, its task - to save the data for audit, planned or in an emergency situation (for such method approaches badly). To understand, at what level this flag appears, it is necessary to find the ultimate user and the interface used by it. If this same application without variants is a part of domain model and interface DAO knows about its existence (for example, in the form of type ad hoc methods findDeleted). If for reading of this flag other application (for example, the regular client of a DB) is used - at you takes place to be integration through a DB, this flag is a part of the protocol of integration, i.e. a singularity of internal implementation DAO. Thus all aforesaid does not influence in any way a choice of specific type DAO: it can concern equally a repository, the gateway of the table of a DB (table data gateway), etc. _> And in addition in the presence of all you start to think, how all it to test. Start to select multifunctions that from them to be isolated. You find out that, for example, IsDeleted should be up to standard DAO, CreatedDate - in Repository, thus 2L it is necessary for you also you think of fastening 3rd party library and it too it is necessary in Repsoitory. And here most likely it to be necessary for you in DAO. Though, any clever auxiliary ( for support, for example, or for collection information) you besides thrust in . As I already spoke, in my representation the repository is variety DAO, and you yet did not offer alternative treatment. Problems with testing I do not see generally any. Even with everything that you mentioned, tests (both a unit, and integration) here will be very simple. That changes what you have a dependence of one component on another with accurately certain interface allowing in need of the test to inject a stub for verification of interaction? _> it is finite, it is too much conditions to lead an accurate line between meanwhile that where concerns. But that it would be desirable to see, this understanding of that Data Layer is not one class in which at first all falls down, and then turns that it is difficult to test and support. _> it should be simple and angry: DAO - object of data access, Repository - object of data preparation to BO. Without any generalizations and "transformations" in DAO as you wrote. To whom should? Here I, by the way, started to understand approximately where you drive. Let's discard for a minute all our representations about patterns-figatternah, and we consider the task in a general view to define them anew. So, we have a business logic implemented within the limits of OOP. There is a data store, more often relational (). We need to provide date transmission from storage in business logic. As storage heavy, implemented by outside people, we want with a view of simplicity of support and testing to isolate access to it in a separate architectural layer. We name it Data Access Layer (DAL). In this layer we will have a quantity of components which will be used by business logic. Following step we define a type of these components, selecting level of connectivity of business logic and storage. If we are ready to sacrifice flexibility in favor productivity, we select the interface of components in which each method represents a certain request to a DB and returns transient object (DTO). We name type of such components Table Data Gateway. If we want on the contrary that the business logic perceived storage simply as a certain collection, we in the interface of components DAL will use type methods to add/replace/remove and we name such components Repository. Each such component will correspond to one essence of model (or one hierarchy). Having defined with interfaces, we start an implementation choice. We will use any standard API for access to a DB which allows us to fulfill SQL queries and to receive in the answer tabular data. As we need to transform a relational model to objective, objective-relational display (ORM) is required to us. It can be implemented independently, building requests and data retrieveds (in that case it is necessary to carry out logic of creation of requests and readings of results in a separate class - Object-Relational Mapper), and it is possible to select the ready ORM-decision which using declarative model of the description of display, reduces the code of your repository to one line in each method. Further, the storage is far from a development node, therefore we want to accelerate its operation at the expense of algorithm of caching. We can use a ready cache, therefore we add in the necessary methods of component DAL attempt of reading from a cache before reading from a DB. The cache will be presented at us by the simple interface with type methods get/putIfAbsent/invalidate, etc. For to specific implementation of a cache to our component DAL, container DI will answer. But is better will adjust in that case a cache in ORM/f and at all on own implementation of logic. As to journalizing and error handling, the code such auxiliary logic not mandatory if you have a possibility to turn your components in proxy which will be calls of methods. It normally becomes by means of AOP. And now attention, a question: and where here actually there should be your sharing on "object of data access" and "object of data preparation to IN"? (Also what such IN?) _> And at once I will answer a possible question about and to the logician in . And who would bring this attention to the question? Like all normal people already use for a long time DI.