Month: June 2008

Maintenance programming

Comment left here – it’s also worth following some of the links in the article.

Never install the Java Decompiler, JAD, and look at the library code you are dependent on.

Just don’t.

If you do, however, never run the FindBugs utility (which I recommend for all lazy code reviewers btw) against the decompiled code.

Just don’t.

Or you will cry.

I’ve picked up lots of code in my time, and the hardest stuff was Java “o-o” code, because everything is buried so deep and bugs very hard to find. Oddly, Ruby is easy to debug once you’ve understood how metaprogramming works and it is an o-o language. But most of the time you just write code to do what you need to do and write tests for that small thing.

UML etc. etc. – guys you are working at the wrong level. UML blah … once you’ve gone past the initial system design it’s another thing to maintain and it wo’t be. Throw it away and make the code base clean. I’m very old fashioned – I tend to start from a clear data model and view the rest as just a layer on top of it. I don’t care about the class model – it’s usually not worth worrying about and a lot of code is procedural code hidden in static classes anyway – be honest, now. This is particularly true if you are using an o-o to relational mapper – that’s where all the complexity is and you have decided that you want the mapper library to do the work. Data matters, the rest is fluff.

I also recommend finding a formatter for the language you are using if you are trying to understand someone else’s code. It’s amazing how many bugs you find when the formatter changes the indentation to reveal what the compiler/interpreter will actually do with the code.

Read Fowler’s refactoring book, even if you are not a Java programmer, it repays close study.

Old fart signing off now.

Setting up to fail

One of the consequences of meditating a lot over several years is you start to see how your own mind works. Obviously, this gives you insight into other people’s too.

If you are feeling down and oppressed by the world, well, how about getting the world to confirm that it hates you? Or that things always go wrong in a drearily predictable way when you interact with certain people?

The game is simple:

  1. Take some task you do collaboratively with others often. Packing to go camping, or some project deliverable. It does’t have to be work related at all: a lot of people do this in the comfort of their own homes.
  2. Decide on your none-affirming goal, e.g. I always do all the work for X,  or, people wo’t take responsibility and be self-sufficient.
  3. Change the unwritten rules of the social interaction very slightly so that you can catch them out, e.g. don’t ask for any help (or ask when it can’t be given because of some other constraint), or, don’t pack the stuff (say towels) that you always pack for everyone.
  4. Crucial part of the game here. Don’t tell anyone about 3.
  5. Let the unsuspecting individual(s) make the “mistake”.
  6. Shout a lot.

Stop it, just stop it. Make sure everyone knows what is expected and check they still understand what it is as the process is running. No-one fails and no-one shouts, life is much easier. People are a little stupid sometimes, and they have short attention spans for stuff that bores them, and what’s important to you may not be to them. Hard luck. I have been in several (failed) relationships where this game was played a lot. I think a lot of the so-called war between men and women is about this, it’s silly manipulative stuff and should be avoided. It’s an easy trap to fall into though, usually when you are down and want to prove something about the world. Keep it at arms length and smile when you catch yourself doing it. And stop it.

I’ve also noticed that when people complain a lot I want to say things like “well, at least you managed to find something to complain about, be grateful you are doing something you enjoy.” Constant complaining is another setting up to fail in a different guise, and it’s bad for your mind. Stop it, just stop it.