Design patterns·Objects and the database between them
the filter was built up as an object and handed to the repository, instead of being ten optional parameters.
Query object
Also calledquery specification, criteria object
Representing a query as an object that can be composed, passed around and translated into SQL at the edge. It keeps a repository from growing forty finder methods, one per combination of filters the UI has ever needed. The specification pattern is a domain-flavoured version of the same idea, with the extra requirement that the criteria are also checkable against an object in memory.