After reading a series of blogs (here and here) by Chris Missal from LosTechies.com on the Specification Pattern I am am really interested in finding more complete examples. Does anyone know where I could find a more fleshed out example or perhaps an open source project that uses this pattern?
In computer programming, the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic. The pattern is frequently used in the context of domain-driven design.
Specification design pattern allows us to check whether our objects meet certain requirements. Through this design pattern, we can reuse expression specifications and combine those specifications to easily question whether more complex requirements are satisfied or not.
Specification pattern is a pattern that allows us to encapsulate some piece of domain knowledge into a single unit - specification - and reuse it in different parts of the code base. Use cases for this pattern are best expressed with an example.
Also take a look at the Dimecasts 'Learning the Specification pattern' for a walkthrough of an example.
Having learned the Specification pattern through the same blogs as you listed, I'm not yet convinced. It could just be that the examples are too simplistic so it seems more work that it's worth. A good, extensive example that shows come genuine benefit would be nice.
Take a look at the "Specifications" paper authored by Eric Evans and Martin Fowler.
The following blog article - "The Specification Pattern" - might also be of use to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With