August 1st, 2008
I love class diagrams. When I’m knee-deep in spaghetti code there’s nothing better to help me understand what’s going on. I’ve even developed an obsessive-compulsive disorder which requires me to have a pen and paper handy at all times ‘just in case’ I need to jot down a little class diagram.
But recently I came across a bit of code that was resistant to the power of the class diagram. What if there are no significant class relationships, just a bunch of static methods?
Here’s what I mean:

The solution: a method call diagram. This diagram just shows a circle for each method and an arrow for each method call. From there it’s easy to see how to merge methods and simplify the call structure.

Obvious? Perhaps, but doesn’t seem to get the airplay it deserves.
Posted in | 3 Comments »
February 1st, 2008
Well after 3 years development we’ve finally released Solar Accounts:
www.SolarAccounts.co.uk

Posted in | 3 Comments »
January 11th, 2008
Think you know Eclipse? Most programmers quickly learn the common keystrokes but don’t take advantage of other good shortcuts. Here are my favourite lesser-known ones:
1. Ctrl-F6 - Next Editor
This handy little keystroke gives you a stack of open windows to cycle through, similar to Alt-Tab in Windows. I use it so often I’ve re-mapped it to Ctrl-Tab.
2. Ctrl-1 - Quick Fix

Okay, so you know about this one. But do you create errors on purpose so Quick Fix can do its magic? This is often faster than typing the correct code. Some examples:
- When creating new variables, don’t declare the type - let Eclipse figure it out from the assignment expression.
- Call a method that doesn’t exist yet and Eclipse will add it for you, complete with semi-intelligent parameter names.
- Need to add or remove method arguments? Just change the method call and Eclipse will update the method declaration.
- On a line with no errors, use Ctrl-1 to ‘Rename in File’, which executes much faster than Ctrl-R. (If the line has errors, you’ll have to select the element you want to rename)
3. Ctrl-T - Quick Hierachy
From within a method press Ctrl-T to quickly navigate to a sub-class implementation or to a super-class definition.
4. Ctrl-Q - Go To Last Edit Position
Does exactly what it says on the tin. Useful when you’ve copied a bit of text and want to paste it into your last edit position. This keystroke is so good I find myself instinctively using it in editors outside Eclipse.
5. Alt-Shift-Up - Expand Selection To Enclosing Element
This keystroke is often faster and more accurate than a mouse in selecting text.
Use Alt-Shift-Down for the reverse operation.
6. Ctrl-Space - Content Assist
Use this outside a method to add constructors, getters, setters and overridden methods to a class.
7. Alt-Up/Down - Move Line Up/Down
Move the current line or selection up or down.
8. Ctrl-Delete/Backspace - Delete Word
These are two “standard” keystrokes used in many editors and are very useful. I have to admit I only discovered them about a year ago!
9. Ctrl-D - Delete Line
Like me, many developers have discovered this one accidentally while habitually pressing Ctrl-S to save their work; “Damn! What did I press?! Hmm… actually that’s quite useful…”
10. Ctrl-M - Maximise Editor
Not used in everyday desktop programming, but indispensable on a laptop. If you use it much you’ll want to turn off the animation (Window -> Preferences -> Appearance). Even then, this feature is noticeably slower than in the good ol’ version 2.0 days.
Posted in | 3 Comments »
October 29th, 2007
Would you rather have a team of three excellent programmers or 15 with average ability? Most programmers would want the team of three, but most managers I suspect would pick the larger team. There’s plenty of support for the idea that the excellent-to-average productivity ratio is at least five, but you occasionally hear, “Well, I could believe two or three times as productive, but five or ten…?”
What’s more, software isn’t just about programming; you need someone to decide what to program. Business Analyst types have their own productivity ratios which are even higher than programmers. Partly this is because their effect is magnified by the size of the team, but also because they can so easily go backwards; they reduce the value of the software they touch.
A good example is the Alt-Tab behaviour in Windows Vista. Since the dawn of time - or at least Windows 3.1 - the window which pops up when pressing Alt-Tab has been comfortingly simple:

But Microsoft and Simple are no longer on speaking terms. In Vista the window has been polluted with little screenshots like this:

The time it takes to recognise the window you want is critical. Any longer than a fraction of a second and you will start to forget why you wanted to switch in the first place. Humans have evolved to immediately distinguish objects with different colour and shape - which makes the original use of icons perfect for the task. But now these icons struggle for impact, competing with (mostly grey and white) screenshots.
Perhaps there was a Business Analyst in Redmond who worried the Mac OSX dock with its little screenshots looked better than the Windows taskbar. Or maybe she ran out of useful functionality to add to Windows. Or maybe she was talked into it by programmers who thought it would be ‘cool’. However it happened, a heap of effort was expended but reduced the value of the software. That’s Negative Productivity.
Posted in | 2 Comments »
June 14th, 2007
Three years ago I chose SWT for my accounting application partly because Swing was painfully bad at rendering text. Since then Swing has come a long way, though it’s still not as good as Microsoft or Apple.
See for yourself; below are examples of different fonts rendered on different platforms.
Times New Roman:

Read the rest of this entry »
Posted in | 1 Comment »
November 8th, 2006
For years Swing has been missing some very obvious components. Java developers have been crying out for common controls such as a Date Picker, Wizard Dialog and Progress Dialog.
Sure, there are dozens of third-party libraries, but these are generally third-rate solutions. I don’t want to use something a kid put together for his college assignment, and I don’t want to pay fifty bucks for a simple date text field. There needs to be one, official, standard implementation for each common control. Microsoft understands this. So does Eclipse. Why can’t Sun?
Having said this, here is my attempt at a couple of these dialogs:

Read the rest of this entry »
Posted in | No Comments »
October 21st, 2006
Benchmarks are tedious to run. You have to compile the code, execute the tests, record the results, create charts and tables. Then the benchmark becomes out of date as soon as a new compiler, JRE or CPU is released.
So I’ve created JavaSpeed, an Eclipse plugin to run a small set of performance tests based on this benchmark. The screenshots are self-explanatory:

Read the rest of this entry »
Posted in | 2 Comments »
October 20th, 2006
Like literally a million other people, I’ve decided to set up my blog. I’m not aiming for a Pulitzer prize, just something above the usual What-My-Cat-Ate-For-Breakfast drivel. I believe Steve Martin said it best in Planes, Trains and Automobiles:
“And by the way, you know, when you’re telling these little stories? Here’s a good idea - have a point. It makes it so much more interesting for the listener!”
For the curious, my old site is here.
Posted in | No Comments »