Symfony Design Patterns
As recommended by Dr. Andreas Klappenecker, my CSCE 222 professor last semester, I have been reading through the Gang of Four’s Design Patterns: Elements of Reusable Object-Oriented Software book this summer. In agreement with Dr. Klappenecker, this is a must-read for anyone who works with code.
I’ve previously written about the Symfony 2 PHP framework, and as the release date draws near (currently in RC6—it has to be soon), I’ve been trying to help the Symfony developers solve user-reported issues on their public repository. Many issues are categorized under “Forms”, so I’ve been trying to understand how Symfony’s Form component works. I had attempted to do this prior to reading Design Patterns and was very confused by all of the abstraction and delegation to other classes. Now that I understand more about software design, it’s much easier to fit the pieces together:
In Symfony 2, the Form component is a Factory Façade object that provides access to a Composite object (enabling embedded forms) that is created via a Builder that delegates type-specific configuration to Flyweight Type objects… These are just a few of the simple design patterns that I’ve read about!
There are many other design patterns used throughout the Symfony framework: a huge indication that it is well-designed.
This is most likely the reason behind its incredible speed and low memory footprint.