Since it was shortly before Christmas, I put a wish on twitter last week:

Anyone who wants to give me a gift for x-mas, consider writing a programming language where “if (* == true)” results in a compiler error.

This inspired some ideas on the twittersphere, and I decided to bring this topic to the Hamburg Software Craftsmanship user group on last Tuesday. Here’s what we brainstormed together: The best programming language, ever.


I need to elaborate a bit on some of them.

Disclaimer: Don’t hate me, I’m just a messenger.

if (foo == true)

I hate looking at code like this:

if (foo == true)

This really should be simpler than that:

if (foo)

There are also more convoluted examples of this. I dare not to mention them. As far as I would say, this should be rejected from the compiler.



is really ugly. I don’t know why to use this to start with. If you can’t hold, use a guard clause, and deal with the else path directly. It will make you happier. Oh, and don’t care about the “single exit from function” paradigm. Only people led astray talk about such non-sense. else is worse.

foo ? whenTrue() : whenNot()

Really, like else before, stop using this crap. You no longer work on 80 x 25 screens, do you? Well, sorry, if you do. But The tenary operator is merely a bad replacement for a conditional with an else. Stop using it. Period.

if – else – if – else

Vertical code is even worse. I think there should be a check on the cyclomatic complexity during compilation time, rejecting code that has a deeper level than 5. Right, maybe such a language won’t become mainstream, but then again, maybe we shouldn’t hire mainstream programmers to start with.

throw null

Yeah, really. That works – or maybe worked a while ago. I didn’t check with later versions of Java. I think Nat Pryce made me aware of this. It ends up in a NullPointerException when the Java exception handler tries to print the stacktrace.

i++ + ++i

For all those friends of C/C++-style languages, this might give you a headache, since the results may vary from language to language, and sometimes even from compiler to compiler (depending on the optimization level you enable).

switch (true)

Yeah, I heard this the first time. NEVER USE THIS!

switch (true) {
case a:
  // code when a is true
case b:
  // code when b is true
case c:
  // code when c is true
  // "else"

Assignments in conditions

while (b = readLine() {

Really? Wtf! No one should write such low-level code nowadays anyways. Stop it, please.

Stuff we couldn’t agree on

There were other stuff that we couldn’t agree on like the never ending vi vs. emacs debate (emacs ftw!). This included checked exceptions, curly braces, and other stuff which seemed to matter for one language only (mostly PHP or Java). Take a closer look on the picture above for these. They are marked with x’s.

So, did I get my gift? Unfortunately not. But maybe someone will dare to build such a language for me – one day. What’s you favorite hated language feature?

PrintDiggStumbleUpondel.icio.usFacebookTwitterLinkedInGoogle Bookmarks