Sync’ up! … without getting drained

apr 20

For goodness namesake

Recently, there was a fun Lobste.rs thread regarding the slog of naming things in our code. It posed an interesting question: ‘Are there programming languages that have been designed to reduce naming things’?

I immediately knew Erlang could not be on the list, as my refactored source-code tends to read like plain ol’ English. Declarative languages like Erlang have this interesting wordy characteristic, it seems. Take any given SQL query, for example. This style of language does me good, for I feel in a perfect world, code ought to meet us half way.

Born from experience

In my earliest days of serious hacking, a mentor, a fellow named Frank Hilf, gave me a puzzle to think about. It turned out to be one that Bruce Eckel came up with, but it’s a great question to ponder: ‘What would be the ultimate programming language’?

His answer? English.

Well, to be fair, any human language could stand in for English. French, off the top of my head, would be excellent in cutting down typing. If memory serves, the liner notes in some of my classical CDs, where the translations are in several languages, have the French translation clocking in at a mere 60% of the given text.

If humans are going to be reading, supporting, and re-writing code, I don’t see why we’d want to eschew one’s strongest language, say, English, in favor of one that reads like hieroglyphics. A language composed of mere words, seems quite natural & wonderfully expressive.

Up the creek

In Erlang, naming can be tricky, as it is elsewhere. But, that’s part of the journey to writing lucid code. ‘A problem well stated is a problem half solved,’ Charles Kettering said. Typically, if I’m having trouble with naming, it’s because I’m fuzzy on the semantics of the underlying function.

Nine times out of ten, naming comes naturally to the subject at hand. Plus, over time, a community develops patterns and conventions that tackled such naming long ago. After you’ve spotted the pattern, it’s just plug-’n’-chug on the naming front, and then time to move on.

Erlang is notorious for being ‘ugly,’ but I wonder what that’s all about. Truly. I like to think most my Erlang code is composed of English sentences, lumped together into paragraphs, and contained in solitary modules. It’s familiar, unsurprising, and quite beautiful when one’s naming is in top form.