Okay, so before I start this next chapter, I have something very important to say. There are a large amount of people out there who believe that PHP is a terrible language. Their claims are based on the fact that 90% of applications built with PHP are of poor quality, don’t perform well, or are extremely vulnerable to attack. This is, in no way, a fault of the language. In-fact, it’s the crappy developers that are to blame. While .NET languages do everything for you (drag a button, double click, change text), PHP developers have to do everything from scratch (write HTML code for button, intercept GET/POST data, display response). This leaves a HUGE amount of room for error, poor design, and, of course, stupid mistakes.
Anyway, PHP is an awesome language, you just have to suck less when writing in it. Now back to the chapter (Security and you!).
I can’t believe I’m spending so much time on this XML subject (granted it’s my weakest area as I haven’t had a chance to use it yet). I think tomorrow I’ll implement the XML manipulation of iTunes AppStore data (that will make a LOT of people happy).
So, yesterday I talked about SimpleXML and the basic way to access the XML data. Today I’ll be covering simple XPath queries and modification.
I’m not sure I totally understand the real purpose of these, but Iterator interfaces are used for performing actions on certain actions/events while iterating the data. From what I understand, implementing RecursiveIteratorIterator will perform actions when entering or exiting a new level of nodes (beginChildren() and endChildren()) when iterating (foreach() / next()) through a recursive object.
Then the FilterInterator interface determines what items should be displayed while iterating. By implementing the accept() method, you can return true to display or false to skip.
I can’t spend a lot of time on this tonight. Been very busy. Have like 15 people over at my house. So I’ll try to be quick.
Anyway, this chapter is all about design patterns in Object-Oriented Programming: