Answer the question
In order to leave comments, you need to log in
Chain of Responsibility and Decorators, how to pass data?
Good afternoon, I use 2 patterns in the action at the same time, decorators, for modifying the object, and a chain of responsibilities for modifying the algorithm, without changing the old code.
when analyzing the code, I saw that it was constantly crawling into the database for one record (for the same one), which, of course, I would like to avoid. Please advise how to transfer data between objects? I use AR.
Answer the question
In order to leave comments, you need to log in
when analyzing the code, I saw that it was constantly crawling into the database for one record (for the same one), which, of course, I would like to avoid. Please advise how to transfer data between objects?There is such an approach as UnitOfWork, in which objects are added from the persistence layer (storage layer), respectively, when there is a repeated call, the query does not go to the database ...
I use AR.And here is the problem, since the AR module is a piece of database work, and not a thing separated from it. That is, she (the model) goes to the store, and not somewhere and someone goes after her ... The clearest example when the violation of SRP has a very painful effect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question