on the smallest possible conditions talks about abstracting conditions behind meaninful method names. Now, let’s say we want to go a step further, and want to reuse the same condition in different parts of the project….
I wish I would explain my super-great-idea about achieving this goal, but as usual, Martin Fowler & Eric Evans have thought about it before me, so here’s just the link to the wonderful pattern called Specification. You could also buy the Domain Driven Design book, as Evans speaks about it in his book.
[...] The Specification pattern. This pattern can be used in a wide range of situations, from abstracting domain constraints to making complex data driven tests more readable thanks to the “outsourcing” of the test data creational logic out of the testcase. [...]
[...] Specification pattern. This pattern can be used in a wide range of situations, from abstracting domain constraints to making complex data driven tests more readable thanks to the “outsourcing” of the [...]