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:
- Preface
- Programming Practices
- The ValueObject Pattern
- The Factory Pattern
- The Singleton Pattern
- The Registry Pattern
- The MockObject Pattern
- The Strategy Pattern
- The Iterator Pattern
- The Observer Pattern
- The Specification Pattern
- The Proxy Pattern
- The Decorator Pattern
- The Adapter Pattern
- The ActiveRecord Pattern
- The TableDataGateway Pattern
- The DataMapper Pattern
- The Model-View-Controller Pattern
- Conclusion
Appendices:
- Patterns Quick Reference
- SimpleTest Testing Practices
update: Had some funny characters in my summary, removed them to see if it helps peoples feeds.
The table of contents looks like an excellent coverage of the patterns that are most often in PHP. Keep up the good work on the “down hill” %50. 😉
I just found out you were working on this book and am avidly waiting its release. Somehow the disjointed efforts on sitepoints forums just does not put a full set of patterns into perspective.