I had a poke around my public services (the stuff on services.signpostmarv.name), cleaned up a bunch of crap that was no-longer in use, then decided to poke around the code for my WebComic RSS service. There’s a mix of UHU4 and UHU5 code in there, so I thought it was time to start upgrading the code to UHU6.
I’m making heavy use of the namespaces & late static binding features in UHU6, so it’s easier for me to keep things organised (yay namespaces!), as well as trimming down on the code used in methods for inherited classes (yay late static binding!). This, combined with my weaning myself off Smarty templating in favour of Object API methods seems to have made the turnaround time for generating the feed much shorter.
At the time of writing, I’ve only upgraded the feeds for Comedity, Dominic Deegan, Flipside and Punch an’ Pie. Additionally, the simplified code for WebComic RSS in UHU6 eliminated a long-standing bug with the Punch an’ Pie feed which caused the strip urls to be borked.
Object API methods
A quick word on what I’m referring to here- basically, I’m using methods with hinted types for the arguments to restrict the input at runtime so I know that the objects going in will be of a specified interface. For instance, the API for my SL Achievements project makes heavy use of the vCalendar format. Rather than creating a never-ending list of parsing rules for the various classes I’ll be creating as I work more on UHU6, I’ve just written a single parsing rule for a calendar class. The calendar class implements the ArrayAccess interface but can only contain objects which implement the “event” interface. Coding to interfaces instead of particular implementations of an interface keeps the code much, much leaner.
