The importance of being willing to ask stupid questions

Last week I spent a day interviewing candidates for a programmer position. One of the candidates discussed things that he looked for in an organisation. Two things in particular struck me: He wanted to work in an organisation that, if he was making good progress, didn’t slow him down and that, if he asked a stupid question, didn’t call him stupid. The first question revealed the candidates lack of experience (not a problem in this case btw) but the second one is very important to a career in software engineering.

Continue reading “The importance of being willing to ask stupid questions”

Hackday London

Its the end of the Yahoo/BBC hackday weekend. The atmosphere at the beginning of the first day was really good and the weekend looked promising. But I left that day early and frustrated. I wanted to try out some of the cool tools being talked about but I couldnt get started because the network was too unreliable. It was a shame. I did meet some interesting people and I saw a great talk on machine tags by Aaron Straup Cope and Dan Catt though. I hope they got the network stabilised later on for the die hards and I’m intrigued to find out more about the final submitted hacks. It was always going to be difficult for me to attend the second day, due to family commitments, and I suppose this means I didnt fully prepare or get into the spirit of things. Looking at the blogs, the vast majority of the attendees got a lot out of it, and only a few lightweights who left early, like me, felt let down. If there is a next time I will both prepare more in advance and ensure I can attend the whole event. Oh, and come with a 3G card in my back pocket.

You lied to me when you said this was a program

A Dutch colleague introduced me to plasmasturm.org a while ago – an excellent software engineering resource. I hadnt noticed it before* but today I was most tickled by a quote he has on his code page:

A friend of mine in a compiler writing class produced a compiler with one error message ‘you lied to me when you told me this was a program’

see plasmasturm.org/code.

* Maybe I did notice it before and didnt get it. Since I first looked at that site I’ve done some work with the RACC, JACC and JavaCC compiler compilers (of the two Java compiler compilers, I prefer JavaCC).

Java status bar

This might save someone else a little bother. I’ve been building Java Swing demo’s in the last few months and one thing that has slowed me down is building a status bar. A status bar is the strip at the bottom of a window that contains useful information about the status of an application.

There is no standard swing control (container) to do this so you must roll your own. Searching for “java status bar” didnt get me very far. Initially I just used a JLabel, but this is too simple. I really wanted something with multiple recessed panels (as in the skype example). I considered using an unfloatable JToolBar but I dropped this idea because a toolbar’s default background doesnt look like a status bar and because its not easy to make the recessed panels this way. Finally I realised that the best way to build my status bar is to nest JPanels.

Now it’s a little tricky to get the status bar behaving correctly on resize, but if you use a GridBagLayout for your top level JPanel then it’s doable. However, a GridBagLayout is pretty horrible to use so I constructed two helper classes, StatusBar and StatusBarPanel to make things eaiser. A StatusBarPanel is simply a JPanel extended with two extra attributes: an integer panelWidth and a boolean fixedWidth. Thus you can define the width that you wish for your panel and whether or not it can stretch on resize. The StatusBar class also extends JPanel and has an array of StatusBarPanel objects. A StatusBar object configures the GridBagConstraints for you when you give it the array of panels.