OOPs!
I love Object-Oriented Programming.
At least, I love the idea of OOP, but in practice it always turns out to be a nightmare. To be fair, this is more the fault of my brain than of OOP, and is true, to a lesser extent, of any and all kinds of programming. It’s just that OOP is so eminently sensible, it leads me to do stupid things.
Case in point, I have spent the last couple of weeks learning Flash and trying to write a simple image browser/viewer using ActionScript, Flash remoting and PHP. Now, this isn’t very hard to do. In fact, I’ve already done it several times, before tearing it down to the ground and starting again. Because, you see, it wasn’t quite right, the code was a bit sloppy, it wasn’t extensible enought, dammit man it just wasn’t OOP!
And this isn’t the first time that something like this has happened - seems that every time I get going on a programming project (and this is the first decent one I’ve got my teeth into for the last couple of years) I start off with high hopes and what seems like a clear idea of what I want to do, but the further I go down the road, the more doubt creeps in. And I can never, I mean never, settle on what seems like the right object model. Should object A contain object B, or a pointer to object B, or should object B contain object A, or… AAAARGH! This just goes on and on for ever.
Still, on the bright side, after nearly killing myself over it last night, I woke up this morning with a gloriously correct object model sitting in my forebrain, and so far it seems that I was largely right. So maybe it was all worthwhile, look on the bright side, I’m learning all the time, I’m getting better at this…
Of course, the likelihood that I’ll ever do enough of this stuff in my life to justify my two weeks of learning is extremely slim. Ah well, at least I was having fun. <cough>