Here are the slides from the SOLID wrap-up I presented at GTA-PHP last night (Google DocsPPTX, PDF).  I’ve also made a gist for the LSP example referenced on slide 8 that I couldn’t find at the time.  I covered the Liskov Substitution Principal (LSP), the Dependency Inversion Principal (DIP) and the Interface Segregation Principal (ISP) in PHP.  I’ve covered SRP and OCP in earlier posts.  I mentioned that I wasn’t particularly fond of applying the ISP in PHP, and Ilia Alshanetsky pointed out that PHP’s performance can suffer if you use too many small interfaces in your PHP.  We discussed the notion of putting constructors in interfaces, and Guilherme Blanco pointed out that since you can’t instantiate an interface an abstract class would be a more appropriate way to require a specific constructor.  Peter Meth and Dan (sorry Dan, I don’t know your last name!) asked where to find a good summary of the SOLID principals, and I suggested the Wikipedia entry, which has a nice table for jogging your memory on the acronym’s meaning.  Thanks to everyone who showed up!

Advertisements