Coding myself crazy

So, I get finished with a roughly 14 hour day of working, about 12 of those hours being on the new St. James website and when I log in to my own Wordpress blog, I am alerted that there is an update to version 2.6! Will it ever end? I hope so. Of course, I’m crazy enough to try updating my Wordpress tonight. If I’m smart, I’ll wait until I have time to work on it.

I’ve been working on putting together the online store today and it’s been a bit of a pain. I am definitely a big fan of object-oriented programming, but there are definitely times where someone can take it too far. In fact, you can use object-oriented programming to such an extent that you manage to obfuscate what would normally be very nice, readable code.

In the case of the store component that I have been working with, the original programmer did just that. The code is a mish-mash of a whole bunch of files, each referencing each other. There are so many levels of things going on that it took me an hour just to wrap my head around the basics and start finding the bugs that I needed to fix.

That brings me to my second point—bugs. When you spend so much energy worrying about your objects, you not only forget to debug some stuff, you actually don’t want to debug. Because there is so much complexity that you have added, it’s a huge pain to debug your code. In fact, it’s a pain for others, too, especially when you hide your SQL queries all over the place and split them up, sometimes using global values for them, sometimes coding them into a function. Pick one method and stick with it. Your code and your users will thank you.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment