Skip to content

Herman J. Radtke III

Tag: #oo

SPL FilterIterator in the real world

The Standard PHP Library (SPL) is a powerful set of tools that are often overlooked. It is very common to see an SPL talk at conferences, but those talks usually just introduce each SPL class to the audience without giving some real world examples. I am going to show you a real world example on how to use SPL FilterIterator in an ecommerce website.

Stop Inverted Reuse

Reuse is a term often used amongst developers.  It usually carries with it a positive connotation and a developer writing reusable code is seen as a good thing.  I think there are a lot of developers who have a completely different understanding of what code reuse means.  When I talk about code reuse, I am talking about reusing logic within the code.  Based on code reviews, it seems the most common definition of reuse is: anytime a function or method is used by two or more callers.  This definition fails to realize the true meaning of reuse and can lead to problems.  In the name of "reuse", I have noticed some developers group common code at the application level by creating functions or methods that solve some pseudo-generic problem.  I call this type or reuse inverted reuse.