Archives for : java

Public static void main: because you’re worth it

I’ve been thinking a bit about the “magic” phrases we find in some programming languages. But then last night, I watched an episode of the BBC’s Outnumbered, where Karen conducts (her take on) a funeral service for a mouse:

…dust to dust,
for richer or for poorer,
in sickness or in health,
may the force be with you,
because you’re worth it.
Amen and out.

The bane of many a Java beginner’s life might be the (slightly less poetic),

public static void main(String args[])

It’s unfair of me to pick on Java specifically, but that’s just an easy example to use. If we repeat that kind of phrase, verbatim, in every one of our first few programs, at which point does it become recitation? It’s like a sort of solemn vow reminding us we’re starting a Java program – a programming ritual. Like various ceremonies, it’s evolved over time, from “int main (void)”, in this case.
Of course, these sorts of things used to be done in Latin, for all that extra weight. Google Translate has alpha support, and suggests “Primor incorporalis sine publico (catena args)”. The thing is, is this actually that less meaningful to, say, a 12 year old?
So, repeat after me:

…for richer, for poorer,
in debugging and at runtime,
primor incorporalis sine publico.
Live long and prosper.*