The Specification Pattern

Last night I sent my chapter on the Specification pattern in for layout. This passes the > 50% mark for chapters through editing and off to layout as well.

This chapter was fun to write because it strays a bit from the Gang-of-Four/Fowler PoEAA design pattern mainstream. Fowler has written some articles on this pattern and Eric Evans covers it in some detail in “Domain Driven Design”. I first show a “hard-coded” example, and then a parameterized specification which can take a WACT DataSource object as the item being tested. The last example in the chapter shows how to create a composite structure of concrete specification objects to act as a “Policy”.

The chapter is an evolution of some early work I did with the Specification pattern in this thread.

By popular request, here is the complete table of contents:

  1. Preface
  2. Programming Practices
  3. The ValueObject Pattern
  4. The Factory Pattern
  5. The Singleton Pattern
  6. The Registry Pattern
  7. The MockObject Pattern
  8. The Strategy Pattern
  9. The Iterator Pattern
  10. The Observer Pattern
  11. The Specification Pattern
  12. The Proxy Pattern
  13. The Decorator Pattern
  14. The Adapter Pattern
  15. The ActiveRecord Pattern
  16. The TableDataGateway Pattern
  17. The DataMapper Pattern
  18. The Model-View-Controller Pattern
  19. Conclusion

Appendices:

  1. Patterns Quick Reference
  2. SimpleTest Testing Practices

update: Had some funny characters in my summary, removed them to see if it helps peoples feeds.