Slowly learning…

March 15, 2009

So I have been hacking on GNOME Do and lately Docky for hours and hours of my day to day life lately.  I am slowly picking up on a couple truths about software development.  I am sure I am not the first to realize this, but I am going to document them here for my sake and maybe any poor soul in my position.

1 – Simple fixes aren’t. Try as hard as you like, the fact of the matter is that you will rarely, if ever, implement something the first time perfectly with 0 bugs.  Additionally, the closer you are to release, the more likely you are to make mistakes.  This is not just murphy at work, this is also due to the fact that you are worried about release and getting things out the door properly.  It makes you sloppy.

2 – Never write code with excessive dependencies. There are always at least two ways to write any piece of code.  There is a quick and easy way, and a longer, harder, more thought out way.  Sometimes it can be very difficult to figure out which is which, but I have found a trick.  The method that relies the least on the other parts of your code will tend to be the best way.  In short, find dependencies, eliminate them, be happy. Sometimes it can be very very hard to notice your dependencies, but there are some big offenders.

  • Instances of classes that depend on (and are the sole users of) static classes
  • Static classes that take in instances of other classes and offer them back as properties (cheat for getting globals)
  • Anything to do with the word singlet.

3 – If you don’t know how to do something, sleep on it. If you are at all like me, your brain doesn’t stop just because you have. Sometimes it is useful to implement something wrong and then see its wrong and do it right, most of the time however it is not. I have in the past run into situations where I was not sure what to do, so I picked one of many options, got it wrong and felt stuck with it.  As time has gone on I have tried to go back and fix those, but there are a lot as they do accrue over time. I find now in these situations that its best to just put things down, and let your brain mull it over for a while (don’t even actively think about it, you will have it come to you). Sometimes I will talk it out, like a crazy person, but hey it works. In the end you will still get it wrong from time to time, but at least you will do better.

4 – Do something more than program with your computer. Programming is fun and rewarding, but you must do other things with your computer.  If you never use it for anything else you will suffer from several things.  Not the least of which is losing your ability to type fast.  Sure you can touch type, but your hands vocabulary goes to the shitter.  Write blogs, or articles, or documentation, anything that requires actually writing full complete sentences in your native language. Never let a day go by without writing a proper sentence or 20.

That is all for today.  I hope to get more blogging done in the future, I find this fun once I get into it.

One comment

  1. I agree with you generally, but I’m not convinced about eliminating dependencies. Even if you have a piece of code which you only make use of in one place, if it’s fairly generic, chances are you’re going to want to use it later. And after all, everyone’s a fan of code reuse. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: