Fang Talks

You just lost it
16 05 14

Applied KISS

KISS stands for Keep It Simple Stupid, stupid.

So today I added feed importing as a feature to SSR2. Before you go crying about feature creep, please, this is pretty basic functionality and doesn’t detract from the application’s simplicity. Besides, it’s been in the back of my head since near the beginning, but only recently I got pushed to implement it. (Thanks for mentioning/requesting it, Mark!)
Anyway, the process of importing is as follows: the user goes to their current RSS reader, downloads an export, and uploads it to SSR2. The application then has to extract all necessary feed URLs from the file, and add them to the user’s list of subscriptions.

Sounds pretty easy, except the export isn’t simply a list of URLs. It’s an XML file, and so you’ll need to parse it to extract the information you need… or do you? Armed with a couple example files, I started looking around. What to use? PHP had some built-in functionality, seemed like a SAX parsing method, something we went over in school recently. Yeah, that seems like a goo- Wait a second!
I just need the “xmlUrl” attribute from each item in the document. Can’t I just search out every mention of that attribute, and see what value’s attached to that specific mention? Hell yeah I can, and piss-easy, too. I split the file up into separate characters and iterated over those one by one, keeping track of what I’d read so far. Did the last few characters read “xmlUrl”? Better pay attention, ’cause we’re reading the URL I need right now!

And it just does that ’til the end of the file. Simple, right? Well of course, and you need to Keep It Simple, Stupid. KISS is a design principle from way back in 1960, but it still stands tall and true today. As its name may suggest, it’s generally better to keep things simple. After all, simple systems will usually function better (or are easier to maintain if they don’t) than larger, more complex systems. And why put in a lot of effort when the same result can be achieved with similar accuracy and reliability and way less effort?

On a somewhat related note, apparently there are RSS feeds that don’t include any dates. To people who provide that: fuck you, you gave me a real headache today.
~ Fang

Post a comment

Your email will stay hidden, required field are marked with a *.

Experimental anti-spam. You only have to do this once. (Hint: it's "Fang")