As I’ve progressed in not only programming skill but also – and, although it sounds strange, probably more importantly – program design skill, I keep finding awful, horrible, terrible mistakes I made just months ago and slap myself on the forehead, exclaiming: What the FUCK was I thinking??!!
Take the current example, which has just consumed most of a day’s worth of time. It’s for a project of mine, a web site which I hope to release very shortly. Like many websites, it has a number of different types of content – mostly static content like menu items and writing on pages, somewhat dynamic content like FAQ items, and fully dynamic content like a news blog. And, importantly, all of this content must be localisable.
Now I don’t know what I had been drinking the day I made these decisions but up until a few hours ago this site had not one, not two, not even three but FOUR distinct, parallel, mutually incommunicado content systems. All of them need maintenance, so that’s four sets of forms, four (actually more like 10) models, any number of weird helpers and controllers to extract data from the 10 or so database tables. It all worked, but it was just a nightmare to even try to juggle it all in your head, let alone build more stuff for and on top of it.
Oh sure, I remember why I made those decisions. I wanted an FAQ page, for example. An FAQ needs categories, and it needs questions and answers. I had a fairly clean interface-translation system from another project, but I couldn’t shoehorn an faq-categories tree relationship in there – so I built another. Same with News – it seemed like more effort to try to unify an attached blog with the current system than to simply build a new one, so that’s what I did. And same with the TWO site content systems – one was for short unformatted sentences and labels, one was for long texts with textile support, links, formatting. I didn’t know how to do them both with one system, so I made two.
A few months down the line and this shit is totally unworkable. Part of building any kind of significantly sized web site is building admin tools as well, or you just can’t cope with adding the text, let alone trying to get others to help you on it. Juggling 4 different content systems just made me want to give up! And yet I knew the work to replace it all with a better system would be painful.
Ah well. Finally the pain of having to use the different systems, and the pure shame of being the author of such a horrible mess, got the better of me and I’ve now unified 3 of the 4 systems. It’s still a hack job, as I’ve got some serious thinking to do about how to handle it all in a manner I can actually be proud of, but it’s miles better than what was there before. The fourth – the blog – will also have to wait. Oh hang on – did I mention there’s actually a fifth? But that only translates names of places, it’s fairly static. I’d like to put that into the new system as well, but it’ll require some thinking. Oh and did I mention I’d like to use this new cms for multiple sites ..
A proper content management system must be totally flexible. You must be able to assign arbitrary attributes to any object in it, at any level. You should be able to say, “see this? that’s an faq category. this, this and this objects descend from it, and of them, this and this need textile. And here are their localised children.” I still haven’t figured out the best way to do all of this, and my research into other popular CMS methodologies has not been encouraging. But I have the feeling it will involve a great big table of text, a table of possible attributes, and another great big table with a membership-style mapping of attributes to that text. Hard to see the best way to do it, but it’ll be an interesting design exercise.
So that’s how we learn .. by trial and error. Think you’re saving time with shoddy design? Think again.
UPDATE NOTE: D2E2D0 E4EDDE