The World Should Be Filled With Magic

And that’s not just some long-haired hippie’s opinion. Wednesday night we had a mini-geek night at work and we got onto the topic of whether or not (code) magic was good or bad. It was a great conversation and because Ade doesn’t have a blog (when are you going to get one?), I thought I’d write about it.

I struggled at first to work out what we meant by ‘magic’ and we somehow concluded at some point, for it to be ‘the unknown’. For instance, when you plug stuff into the Rails framework, there’s some sort of ‘magic’ going on to hook it all up. The focus of the discussion was really about whether or not we thought magic was good or not.

To actually substitute our other meaning, ‘the unknown’ for magic makes the question a very strange one – ‘Is the unknown good or bad?’

My attempt at answering this question was that the concept of magic is not good or bad, but whether or not the attempt at magic is good or bad. In general, I personally like magic because it makes my life easier. I shouldn’t have to understand how the compiler, for instance, turns code I write into bytecode every time I want to do something. I like the fact that it just works and that’s how it is. The abstraction or illusion holds true every time I run it and I can depend on it to work day in and out.

I consider magic good if it doesn’t require you to understand it. Bad magic on the other hand is bad because it forces you to work out how it works, and that need, let alone the experience, is generally traumatising. It’s like a magician’s illusion failing us because you have to go behind the scenes to understand all the little tricks that made it work. What can make it worse is if it is difficult to investigate how it works such as the source code not being available, or horrible code that’s hard to read, or an abstraction that just doesn’t work.

All of this is circumstantial and really depends on how well the magic was built. If the magic works all the time (and generally that’s because the abstraction is sound) and it does all the things that you need, then I think it’s a good thing.

We Are Not Alone

I’ve been waiting for one of the Underground stations near me to open since I moved into my current flat. When I first arrived in London, Queensway was due to open in May (with my own guess being the end and not the start of the month). It’s now not due to open until the second week of June now, even after a year of planned work and an entire month to get it right. Wembley stadium is yet another great example of a construction project way off schedule – and so I find it rather strange that people continually try to make out that the construction industry is any better planning than in our industry of building software.

The Anti Screen Saver

Build information radiators are useful for improving the visibility of the state of the build – bright green if it’s good, or bright red if it’s broken. On our current project we’ve been trying to assemble all the hardware to get some lava lamps going, but in the meantime we’re using a very old PC and its tiny CRT monitor to glow bright green or red.

A problem we had was the Power Options settings turns off the monitor after 20 minutes of (in)activity and it’s been too difficult to get Administrator privileges for the machine. Although not necessarily the most ideal solution, the most amenable one for Friday was a small program that moves the mouse cursor every the minutes. Get the results here if you want.

Usage:

java -cp MouseMover.jar <number of minutes each time you want the mouse moved>

Jumping through too many hoops just to complete one loop?

Feedback Loop of Java ProgramsOne of the benefits you get with consulting is that you get to see a variety of applications, processes, and in agile projects, different build pipelines. I take the developer loop very seriously, because how quickly you can get feedback determines how quickly you get serious things done. Different testing strategies are an important way of improving the amounts of feedback (as long as you can still write meaningful tests). Another technique is the ease with which you can configure various libraries, integration points and environments. Even splitting the build into various stages where failing earlier is more appropriate can help you get better feedback.

Feedback Loop of Interpreted LanguagesThe ultimate feedback loop I’ve seen in Java is the “change-compile-run test” loop. Anything more and you will decrease your feedback cycle and adversely affect how fast you can develop. Anything less than this is unacceptable – skipping the “run test” stage doesn’t do anything to validate that what you wrote actually works. On a side note, in an interpreted language, the loop is even tighter, simply being “change-run test”.

J2EE’s “Enterprise” Feedback Loop
I’ve worked on numerous J2EE systems that were all business successes. As a developer though, it still makes me cringe thinking about the feedback loop, and how long it takes to make a change to a class, or one of many, many XML files, jar up something several times, and then actually test it.

Feedback Loop of J2EE Applications

Optimising Your Build Loop
Visualising your build process is an excellent way of seeing exactly how many hurdles you have to go through to get any decent feedback. Even better is trying to work out which things you *really* need in a build and removing anything that just doesn’t add any value. I try to aim for the simplest and fastest feedback that you can get using the above diagrams as the ultimate goal. Give it a go!

It’s Never Been About The Hours

StopwatchI started at a new client yesterday, and we had a great conversation on my thoughts about working overtime. Anyone who has worked with me in the past knows that as a principle, I heavily dislike working overtime. I think I provided some pretty good reasons and thought I’d write about it.

I am a big believer in the “Sustainable Pace” concept because I think that quality software development is a limited resource. Even though I dislike working long hours, they’re inevitable because of various reasons, and when I’ve worked long hours, and witnessed other working long hours, I’ve observed developers get tired, and when they get tired, they get sloppy. For a project that will be running for a long time, you really don’t want that.

The reason I think of it as a limited resource is because if you have ever done solid software development, you will find it requires constant judgement, thinking and in general just solving problems and puzzles all day. It requires a large number of micro decisions and is a tiring exercise with a physical limit for how well you can sustain this before quality starts to suffer. Imagine playing sudoku all day long and see how long it is before your brain starts to tire (and I just did that with the amount of flying I recently went through!)

Of course some people handle this differently. Some developers I know, prefer to spread out this thinking with various breaks of checking email, surfing the web, etc. I’ve heard of stories where some developers will do these bursts in a series of several consecutive long days, but have lots of down time in between. These developers should never be confused with developers who are just lazy and continually check email, surf the web, or better yet “work from home”. I also think that the latter developers have no pride in their work and should not be in our industry.

I do agree that in some circumstances, it is important to be able to tap into “extra hours” and that it should be exceptional circumstances. The illusion that needs dispelling is that there are no “extra hours”, and that at some point, developers will need to rest and to be effective.

I suggest to business people who I’ve worked with that it is better to maximise the value you can get out of the limited resource, instead of trying to mine more of the resource. Oh, and did I mention that maximising business value is what agile is about?

Beware HttpUnit and NekoHTML

The latest version of HttpUnit still doesn’t work well with NekoHTML. Certain behaviour in NekoHTML parsing HTML into a DOM and assumptions in HttpUnit means that trying to set parameter values for a SELECT parameter fails even though you know it’s a valid option value. The current workaround is to use JTidy thought we’re still considering switching to HTMLUnit to improve performance issues we’re having. I have to remember to try disabling javascript interpreting in HttpUnit as I remember this was quite a slow down for tests on a previous project.

Down by the Poole

Poole

Looks like I’m back in Poole after six months. Updates to this blog may be far and few between as access to the Net is scarce and finding time to write even more so. Poole hasn’t changed much since I was last year. It seems like Biker Tuesdays are back on, the weather is getting a little bit warmer and the sunrises are quite spectacular.

Sunrise in Poole