Define pedantic

2010-11-02, Comments

My dictionary defines a pedant as:

pedant n. 1. A person who relies too much on academic learning or who is concerned chiefly with academic detail.

Apparently the word derives from the Italian, pedante, meaning teacher. During my career as a computer programmer a number of my colleagues have been surprisingly pedantic about the proper use of English.

“I refuse to join a supermarket queue marked 10 items or less.”

“I do wish people would stop using target as a verb. You aim at a target, you don’t target it.”

“I am an exceptionally skilled grammarian in English … Take that rule and shove it!”

Some of this fussiness may well be a reaction against corporate double-speak. Still, I wouldn’t have expected programmers to be 1) so particular and 2) so certain they’re right. Maybe this attitude comes from all those years of writing code. Programming languages are strict about what they’ll accept: after all, they have standards!

The C++ Standard vs Perl in a Nutshell

Some programming languages are more pedantic than others. Paul Graham memorably characterises C++ as a pernickety aunt[1]. By contrast, Perl won’t pick nits. Designed by Larry Wall to be his software butler, Perl interprets your ill-expressed wishes with discretion and assurance. Hence you can end up with a Perl program which gets on with its job but which no-one fully understands.

Pedants, by definition, take things too far, but pedantry in programming isn’t all bad. GCC has a useful -pedantic flag. It helps you write portable programs. Perl has a use strict pragma which recasts the butler as a personal trainer.

When it comes to correctness, attention to detail matters. What if this input parameter goes negative? Will that file be closed when an exception is thrown? Can your algorithm handle an empty container?

I recently fixed a defect in some (of my own) code which assumed conformant input. When faced with garbage-in this code failed even to generate garbage-out, instead getting caught in an infinite loop. Should a pedantic program insist on correct inputs or should it consider how to handle all possible inputs? Define pedantic.


[1]: It turns out my memory is at fault here. When I checked the reference I discovered Paul Graham makes no explicit mention of C++.

We need a language that lets us scribble and smudge and smear, not a language where you have to sit with a teacup of types balanced on your knee and make polite conversation with a strict old aunt of a compiler. — Paul Graham, Hackers and Painters

You might have guessed which language he’s promoting for scribbling but there’s no mention of Lisp either in this particular essay. In fact only one programming language earns a name-check. I’ll let you find out which one for yourselves.