问题
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?
回答1:
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.
回答2:
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.
回答3:
I actually think the Wikipedia page (at the time of this post) is a more concise and easier to absorb example of using the Specification pattern...lostechies.com actually references it.
Here is the link: Wikipedia: The Specification Pattern
回答4:
For me one of the best examples is the Route Specification
that Eric Evans uses on his book.
The source code is here, it is written in Java but is very easy to understand and translate to C#.
回答5:
You can find many sample projects about design patterns (Specification Pattern as well) here from "Professional ASP.NET Design Patterns" book.
来源:https://stackoverflow.com/questions/1436663/specification-pattern-example