Dirty Source Code

Why, oh why do classes, which have the purpose to remove something from documents, always have to be named “XYZStripper”? As a programmer faithful to the (often unwritten) coding conventions, I have to name instances of such classes of course - “stripper“. Unfortunately the names of those stripping methods do not quite match the juicyness of the class name. I would like to code things like stripper.renderNaked() or stripper.undoClips().

And with a swing of her hips
She started to strip
To tremendous applause
She took of her drawers

And with a lick of her lips
She undid all her clips
And threw it all in the air
And everybody stared

Chris de Burgh: Patricia the Stripper

Name That Code

Name That Code
Created by OnePlusYou

I named those codes, and boy, what a miracle - one hundred percent right. Try it yourself!

Lightweight Developers

Maybe I like Ruby because I’m a lightweight developer? See for yourself:

via RedHanded.

Beans, Snakes, Gems

This will not be another programming language comparison frenzy. I had just some semi-serious thoughts about something I would call “language marketing”:

If you are starting to design a new programming language, start thinking of language identity. I do not know whether this term existed prior to this posting, but language identity is for programming languages what corporate identity is for enterprises. Of course, the scope of the language and all the nifty little features and whether it is compiled or interpreted and for which platforms the language is available is of some importance - but to make your language known, you need a lot more sexiness. This language sexiness is made by (but necessarily limited to):

  • A logo. Or better, an allegory. As we see in successful languages, this does not have to be an animal (although this helps a lot with O’Reilly). Java has the coffee, Python has the snake (although the name comes from the British comedy group), Ruby has the gem.
  • The name. C++ is a notable exception, taking its fame mostly from its predecessor C, which did not need a fancy name because it was the programming language sent to us from above in the Old and the New Testament. But most popular languages have names which are good to remember. Ask five developers how they are pronouncing “C#” and you will get six different answers.
  • A web site. This serves as a hub for everything about your language. The Python page, for example, is so resourceful that keeping a local documentation for the language should never be necessary. There is even a Firefox sidebar for easy access to all the information on the pages.
  • A figure head. At best, someone as strange and bearded as Larry Wall (PERL), at least some guru whose name is not even mentioned in full (like DHH instead of David Heinemeier Hansson, Rails/Ruby), or only by first name (”Bjarne said …”).

Sneaky Snippets (1): Infinity

I found this beaut in a Delphi system I co-wrote while studying:

const
  UNENDLICH = 99999999;

Please note that (in this case) unendlich is the german counterpart for infinity.

This looks worse than it actually was. The system was an LL(1) parser generator and in order to increase performance we used fixed-length arrays for all kinds of collections, and we had to set a maximum upper bound for array indices. Maybe we shouldn’t have called it infinity, though.

Regex Superhero

One of my favorites from XKCD:

Regular Expressions