Archive for May, 2009

31
5/09
6

To Cancel, Don't Click Cancel

I have been reasonably happy with Webbynode, where HappierHour is hosted, both in functionality and service and was happy to see some new features the last time I logged in. While poking around the new pages, I found this on the “Close Account” page:

Cancel Warning

Bad dialogs and button combinations have always existed and will probably continue for quite some time, but this one surprised me coming from Webbynode. It is not so bad, but I am disturbed by “Otherwise, click cancel.” There is not a “Cancel” button, and the only button with the word cancel on it does the opposite of what the user wants.

Luckily for Webbynode, it is probably not an oft-visited page, but one accidently canceled account will make it an expensive mistake.

19
5/09
0

My, What Have You Done To Java?

In the first chapter of every beginner’s Java book, the reader is introduced to code like this:

public class MyClass {

    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}

Its simplicity is important to not discourage the reader and its brevity allows for quick and continuous enhancement. But within the first line, it has started the reader down the wrong path in what is considerably more important long term.

Later, a code snippet like the following might be used to explain some features in greater detail:

MyClass myObject = new MyClass();
myObject.myMethod();

Again, the deterioration of good programming skills has started before those skills were allowed to develop.

Why are beginners taught these bad habits when it is just as easy to teach with proper programming styles? The use of the prefix “my” does not provide any insight to what that class/object/method actually does. Despite the difficulty of naming things, it is far better to demonstrate good programming practices and have a 90% intuitive name, than to have a name that is simple but meaningless.

Java is the most notorious for this, but other languages are equally guilty. If you are writing a tutorial somewhere, especially if it is for beginners, take extra care to ensure your code is portraying proper style, so first-time programmers will not have to dig themselves out of any deeper of a hole.