The Specification Pattern

By Jason. Filed in PHP  |   
Home del.icio.us this! Digg this! RSS 2.0 

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.

2 Comments

  1. Comment by Christopher Thompson:

    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. ;)

  2. Comment by NotThatBright:

    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.

Leave a Reply

Your email address will not be published.