The Modern Programmer’s Dictionary

In the field of  software development, there’s always something new to learn. Whether it’s a new language, framework, API or methodology, your need to study is never through – even if you’re a FORTRAN developer. But one of the more esoteric areas of your education will come in the form of the language programmers use, and I don’t mean programming languages.

And so I present to you a dictionary of modern programmer language (much of it shamelessly lifted from a discussion on Stack Overflow):

Ajah

Ajax, but returning HTML rather than XML (e.g. using jQuery‘s $.load method). Similarly, Ajaj, when you expect script to be returned (e.g. $.getScript).

Bicrement

Adding 2 to a number.

Boolean Zen

A principle of programming lacked by those who perform expressions to compare variables to boolean constants. For example, if (userHasLoggedIn == true) lacks Boolean Zen, because the == true at best does nothing at all, and at worst results in an unnecessary evaluation.

Classtrophobia

When someone chooses not to use the obvious object-oriented approach when it is available.

Common Law Feature

A bug in some software which has existed so long that it has begun to be depended upon by the users, who will complain loudly when it is “fixed”.

Doctype Decoration

In web development, the practice of putting a Doctype Declaration (e.g. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">) into the document despite not actually writing standards-compliant code. Often accompanied by putting a “Valid HTML & CSS” link on the site, but never actually checking that the site passes the validator’s test.

Egyptian Brackets

That style of coding which puts the opening brace { of a block on the same line as the expression (wrapped in parentheses) before it, e.g.:

if (expression){

So called because the ){ sort-of looks like a stereotypical ancient Egyptian pose, depending on your preferred coding font:

Floater

A bug that sits at the top of the bug tracking system, but nobody claims responsibility for it. Everybody just works around it.

Flock of Geese Code

A block of deeply-nested and heavily-indented code forming a tight V-shaped wedge. Often occurs when adding functionality to a complex block of evaluations, by a developer who hasn’t noticed that perhaps a return statement, exception-handling, the && operator or even a goto statement might be more appropriate! Especially poignant when using a bracketed-block language, where you’ll see a string of closing braces flying away at the end of the code.

Hi-Driven Development

A variety of printf-debugging where you pepper your code with alert('hi'); in order to find out where it’s going wrong, rather than breaking out a proper debugger. Other acceptable string literals include “hello”, “here”, “xyzzy”, etc.

Higgs-Bugson

A bug that you believe to exist based on sparse log data and theoretical examination, but you have no evidence to support the idea that it has ever actually been observed, except perhaps vague anecdotal evidence from users.

Hindenbug

A catastrophic bug resulting in a devastating loss (typically of data). “Oh, the humanity!”

headlessCamels

CamelCase words lacking a leading capital letter, as required or recommended for various languages, frameworks, and styles. As opposed to ProudCamels.

Heisenbug

First noticed on Usenet in the 80s, but still awesome: a bug that defies investigation because, during debugging (when you’re observing it), it behaves differently.

Hydra Code

Code so bug-riddled that killing one problem results in two more in it’s place, like the mythological Lernaean Hydra‘s many heads.

IRQed

Interrupted while you were trying to program. Not necessarily by somebody with an actual flag.

Loch Ness Monster Bug

An important bug, if ever it could be proven to exist. Only ever observed once or twice by users who were unable to back up or reproduce their claims. These users often go on to swear by the existence of the bug, blaming it for all kinds of unusual phenomena even in completely unrelated systems for years to come.

Ninja Comments

Comments which are so stealthy that you can’t see them at all. It’s almost as if the code weren’t documented at all!

NOPping

Like napping, but what programmers do while they’re downtiming while waiting for a computer to finish a task. Based on the NOOP or NOP operation found in many low-level languages.

NP Hilarious

An algorithm whose complexity is a joke, whether deliberately (e.g. Bogosort, but not Quantum Bogosort) or not.

Object Oriented Pasta

Spaghetti code wrapped up into classes to look like proper object-oriented code. Also Ravioli.

Pokémon Exception Handling

For when you positively, absolutely, “gotta catch ’em all.” I’m talking about hideous code like this:

try {
MessageBox.Show(message);
} catch(Exception exc) {
MessageBox.Show(exc.Message);
}

See also Try, Catch, Forget.

Refucktoring

As defined by Jason Gorman: refactoring code in such a way that you are now the only person capable of maintaining it. E.g. stripping all comments and whitespace from an arcane bit of code that you wrote in order to give yourself the illusion of being indispensable. Results in Mortgage Code (code which pays your mortgage because you can’t be fired while it exists).

Rubberducking

Sometimes you’re working on a problem and what you really need to do to solve it is to talk through the problem with somebody else. The other person doesn’t even need to be a developer: often, they don’t even need to listen – they just need to be there while you talk your way to your own solution. So much so, that they might as well be replaced with a rubber duck, sat atop your monitor. A name come up with by a programmer who apparently actually did this.

Scar Tissue

Commented-out blocks of old code, after refactoring, that have been checked in to the main codebase.

Shrug Report

A bug report which contains no reproducible information whatsoever, or is so unclear as to be ambiguous. Often contains phrases like “doesn’t work”, or doesn’t show how the anticipated behaviour differs from that observed (e.g. “when I click the print icon, the document is printed onto A4 paper from the feeder tray of the printer”).

Smug Report

A bug report submitted by a user who acts as if they know more about the system than the developer does.

Stringly-Typed

Use of strings for all kinds of inappropriate variables, like strings containing the words “true” and “false” for use in comparisons (not helped by the fact that some languages, like PHP, will let you get away with boolean comparisons on these). Also common among inexperience database developers, who’ll make an entire database of VARCHARs because they’re then able to store whatever they want in there, right?

Troolian Logic

Using a boolean variable to deliberately hold three states of information: true, false, and null. Often requires the use of the === operator to function properly.

Try, Catch, Forget

An exception handling strategy based purely on catching exceptions and then doing nothing with them. In other words, telling your program “if something goes wrong… carry on anyway!” Sometimes also seen as a Trynally – a block of code with a try and a finally block, but no catch blog at all. See also Pokémon Exception Handling.

Unicorny

Adjective used to describe a requested feature that’s so early in the planning stages it might as well be imaginary. Used by Yehuda Katz to describe some of Rails‘ upcoming features.

Yoda Conditions

Expressions that test for (literal == variable) rather than the more-common (variable == literal). The former is preferred by some programmers because it reduces the risk of accidentally using a single-equals rather than a double-equals (this mistake would produce a compiler error rather than simply misbehaving). So-called because it results in Yoda-like phraseology (e.g. “has no errors, the form does”).

×

Sleepless? Priceless!

  • Time for this iteration of a software project: 4 months
  • Time left after the client changed their mind about the “must have” requirements: 2 months
  • Amount of sleep within the last 40+ hours: 4 hours
  • Number of JOIN clauses in an eleventh-hour SQL statement that suddenly fixes everything: 12 (LEFTies, RIGHTies, INNERs… and also a UNION)
  • Time internal deadline missed by: 55 minutes… which isn’t actually that bad, considering everything that went wrong in the 55 minutes before them
  • Money earned: nil
  • Feeling after delivery complete: priceless*.

* also: knackered – guess I’d better get some sleep!

Writing A Calendar App In Rails Vs. PHP

Some time ago, I wrote a web-based calendar application in PHP, one of my favourite programming languages. This tool would produce a HTML tabular calendar for a four week period, Monday to Sunday, in which the current date (or a user-specified date) fell in the second week (so you’re looking at this week, last week, and two weeks in the future). The user-specified date, for various reasons, would be provided as the number of seconds since the epoch (1970). In addition, the user must be able to flick forwards and backwards through the calendar, “shifting” by one or four weeks each time.

Part of this algorithm, of course, was responsible for finding the timestamp (seconds since the epoch) of the beginning of “a week last Monday”, GMT. It went something like this (pseudocode):

1. Get a handle on the beginning of "today" with [specified time] modulus [number of seconds in day]
2. Go back in time a week by deducting [number of seconds in day] multiplied by [number of days in week] (you can see I'm a real programmer, because I set "number of days in week" as a constant, in case it ever gets changed)
3. Find the previous Monday by determining what day of the week this date is on (clever functions in PHP do this for me), then take [number of seconds in day] multiplied by [number of days after Monday we are] from this to get "a week last Monday"
4. Jump forwards or backwards a number of weeks specified by the user, if necessary. Easy.
5. Of course, this isn't perfect, because this "shift backwards a week and a few days" might have put us in to "last month", in which case the calendar needs to know to deduct one month and add [number of days in last month]
6. And if we just went "back in time" beyond January, we also need to deduct a year and add 11 months. Joy.

So; not the nicest bit of code in the world.

I’ve recently been learning to program in Ruby On Rails. Ruby is a comparatively young language which has become quite popular in Japan but has only had reasonable amounts of Westernised documentation for the last four years or so. I started looking into it early this year after reading an article that compared it to Python. Rails is a web application development framework that sits on top of Ruby and promises to be “quick and structured”, becoming the “best of both worlds” between web engineering in PHP (quick and sloppy) and in Java (slow and structured). Ruby is a properly object-oriented language – even your literals are objects – and Rails takes full advantage of this.

For example, here’s my interpretation in Rails of the same bit of code as above:

@week_last_monday = 7.days.ago.gmtime.monday + params[:weeks].to_i.weeks

An explanation:

  • @week_last_monday is just a variable in which I’m keeping the result of my operation.
  • 7.days might fool you. Yes, what I’m doing there is instantiating an Integer (7, actually a Fixint, but who cares), then calling the “days” function on it, which returns me an instance of Time which represents 7 days of time.
  • Calling the ago method on my Time object, which returns me another Time object, this time one which is equal to Time.now (the time right now) minus the amount of Time I already had (7 days). Basically, I now have a handle on “7 days ago”.
  • The only thing PHP had up on me here is that it’s gmdate() function had ensured I already had my date/time in GMT; here, I have to explicitly call gmtime to do the same thing.
  • And then I simply call monday on my resulting Time object to get a handle on the beginning of the previous Monday. That simple. 24 characters of fun.
  • + params[:weeks].to_i.weeks simply increments (or decrements) the Time I have by a number of weeks specified by the user (params[:weeks] gets the number of weeks specified, to_i converts it to an integer, and weeks, like days, creates a Time object from this. In Ruby, object definitions can even override operators like +, -, <, >, etc., as if they were methods (because they are), and so the author of the Time class made it simple to perform arithmetic upon times and dates.

This was the very point at which I feel in love with Ruby on Rails.

Our Web Developer’s “Line Of The Day”

Yet again my concern for the value of an Internet Computer Science degree from UWA is raised, as a dippy co-worker with two years of such a degree behind her asks me for help:

“Dan,” she begins, “How do I make a table in PHP?”

For those of you that don’t know quite as much about web design as she should, PHP is a programming language used, amongst other things, for developing dynamic, flexible web sites which integrate with other data sources. This weblog, for example, is powered by PHP. It is most frequently used to output HTML, the language of the web.

“I think you mean HTML,” I reply, seeing what she’s trying to achieve – the alignment of two text fields with their corresponding labels. She’ll need a simple two-by-two table. The code for this is as follows:

<table>
  <tr>
    <td>
      Top-Left Text
    </td>
    <td>
      Top-Right Text
    </td>
  </tr>
  <tr>
    <td>
      Bottom-Left Text
    </td>
    <td>
      Bottom-Right Text
    </td>
  </tr>
</table>

What are they teaching them these days? I remember learning this at about age 14, using Netscape’s examples. This girl has been studying Internet-fucking-Computing at degree level for two years and hasn’t been shown this?

Don’t even get me started on the fact that she shouldn’t be using a table for the purpose she was trying to use it for.

Update 2023-12-07: In hindsight, I made a knee-jerk reaction in writing this blog post. I should have treated this junior developer as what I’d now call “one of the lucky 10,000” and been more-supportive and a better teacher. We’re all learning, and back in 2004 I clearly had a lot of learning still to do.

PHP 5 RC1

Terribly geeky I know, but I find it awfully exciting: PHP 5 Release Candidate 1 was released today. PHP 5 can now be considered feature-complete, and mostly stable. If only the program I’m writing with it could be considered the same…

Amusing Line From The Python Manual

I just extracted the following line from the Python documentation (for those of you who don’t know, Python is a relatively-new and somewhat unusual programming language who’s name is derived not from the snake but from Monty Python):

Attempts to pickle unpicklable objects will raise the PicklingError exception; when this happens, an unspecified number of bytes may have already been written to the underlying file.

You have to love any manual with that line in it! It almost beats the famous Fortran line about defining pi as a constant in case it’s value changes.

Alone, And With…

People who are in on the Secret Of The Jukebox will be delighted to hear that I’ve had a good long hack at it tonight (hence it being 4:30am) and I’ve managed to get heaps done and ready for Paul to break test, including but not limited to the new “Alone, And With…” engine, which doesn’t seem to suffer any longer from the age-old bug that gives it it’s name.

I’ve just finished listening to some old hard-to-get Goo Goo Dolls albums that I acquired a little while ago. One is silly over-punky shouty hard rock stuff; very coarse and unrefined, much unlike their later stuff. The other, ‘Hold Me Up’, is much recommendable: some tracks I’d heard before, some stuff I hadn’t heard, all very very good. In particular, enjoyed ‘Laughing’, ‘Kevin’s Song’, and the older version of ‘Two Days In February’. Toy.

I Wanna Wake Up Where You Are

Watching a Goo Goo Dolls concert on VideoCD.
They’re really quite remarkably good. I suppose you can’t help but respect the artistry that goes into making a song for which you need to re-tune your guitar such that five strings are tuned to the same note. I mean, can you see the conversation now? “Hey, Robby: tell you what, why don’t we see what this sounds like…” And Gutterflower is a simply stunning album.

Reading MMURTL v1.0 (Building Your Own 32 Bit Operating System)
It’s really quite remarkably geeky. I spent Christmas reading quotes from it to my family, Claire, and her dad. Claire understood bits of what I said. Sometimes. It’s great – a 600-page A4 book which contains at least 200 pages of solid assembly language (the most hardcore programming anybody could ever really justify doing) and another hundred of low-level C. It’s on a short print run – the attached CD-ROM is on CD-R media.

Missing Claire.

Some Days You’re The Statue; Some Days You’re The Pigeon

I’m at the office. It’s almost 5pm. So far today I’ve achieved what should be estimated as approximately 7 days work. Some days the code just flows. I like being me.

On the other hand, it may be that I’ve just written the wrong 7 days worth of code – as in; the 7 days worth of code I should be starting next week. Despite having achieved the entirety of my work schedule for the next month, I haven’t yet finished what I was supposed to be doing this morning.

My boss is pretty level-headed and appreciates the way I work, though – that if he doesn’t expect me to do things in the order he asks, and he doesn’t mind that some days I achieve nothing but surfing the web and posting to my blog, and that other days are like this one, with immense productivity. I’m an outlier even by software engineering standards. I’m a bit of a loose cannon. But in any case; I’m worth more than he’s paying me and we both know it, and neither of us care terribly, so everything’s pretty damn sweet.

Got my assignment in on time. Think I’ve done it quite well (actually went to the library and read old journals and books and things – very scary and academic and cool at the same time: after all; it’s just about possible to pass a comp. sci degree with Google as your primary reference). Time will tell.

Chez Geek night tonight at the Ship. Looking forward to it.

Bovini: A Week Well-Spent

It’s been a busy week. I’ve spent a lot of my time at the office, trying to get the replication model for Bovini working – causing much stress as it failed time and time again. For those of you without a grounding in computer science theory, replication is the art of making data be identical (and editable) in several places at once without the fundamental problems that this goes on to cause, such as data identity conflicts.

In this particular case, we have two master copies of a database, and five smaller copies of a particular one-fifth of the data each (plus a little shared data), split around seven UK sites, and who’s computers can only be made to talk to one another between the hours of midnight and 4am each weekday. So: not only does the program I’ve been writing (and sweating on, crying over, and shouting at, this week) have to pull all the data back together and spread it out, it also has to detect whether two users at different sites edit the same piece of data during the same day, work out who’s most likely to be ‘right’, and ‘fix’ the data accordingly. Or, if it’s not sure, know who to ask for assistance. It’s a clever program.

And now it seems to be done. And working. Great!

Unfortunately, working like a dog on this little project has only taken time (and energy) away from my preferred software project – Three Rings – a program I’m writing for free for National Nightline. I’m likely to have a busy weekend catching up!

Regardless, tonight… will be a night for relaxing – Bryn, Claire, Paul, Kit and I are going to spend the evening in the Ship & Castle, drinking Real Ale and playing Chez Geek. A perfect way to end a week.

Edge of darkness

This is a repost promoting content originally published elsewhere. See more things Dan's reposted.

This repost was published in hindsight, on 22 March 2019.

Kit wrote:

A day of energy and focus. Paul and I hacking through stuff, fixing, tweaking, making work, prodding, pushing.

Its a slick operation. Paul and I discuss bugs and problems, mark them up on a whiteboard on the wall (installed for the purpose) and clear off fixed issues. Dan chews through problems in staccato style – a quick hit and run raid on a bad patch of bugs, followed by some Civilisation 3.

I spent much of the early part of the day creating new icons for the help section and improving some others. Later on Paul replaced me at the terminal – weaving together a gossamer of information into a cohesive and structured explanation of how the system works.

Bryn closes hostilities with a QA roundup. Vigorous and detailed, he pulled out anything he found that was out of place or untidy in the help system and listed it for change.

So its morning. We’re a touch behind schedule – but quality of the product is all. We are determined to fix the “showstoppers” (big bugs) and make a good dent in anything silly outstanding before we declare it released. I can see that taking a few more days.

Paul and I were left discussing its worth in our currently debris-strewn living room. What does this project actually mean? It means a lot – to me, to Dan, to everyone involved. Most of all its yet more proof of the magic that is Aberystwyth.

At the edge of darkness, all that is left is tomorrow.

Progress!

Working late. I’ve got Club 977 (best 80’s cheese on the ‘net!) playing as loud as this computer goes, slamming out code at a rate more productive than I’ve been all week. Finally got past a bug that’d been troubling me for days. Phew! Just in time for a meeting tomorrow!

I’ve been getting a lot of concerned attention after my post, “Stress!”, earlier (I didn’t think I had so many avid readers). Thanks, all of you; you concern means a lot, but really – I’ll be okay: I land on my feet, remember! Just need to get my head down and get on with some stuff, that’s all, and a little bit of de-stressing onto the web was good, too.

A few more lines of code, methinks, before Claire arrives (she’s kindly giving me lifts to and from work while I’m being a lazy bugger and not sorting out my bike, the star).

Take care, y’all;

AbNib

I’m almost ready to launch AbNib (main site may be down during development, but try the temporary mirror), a site dedicated to the weblogs of Aberites: people who live in or love Aberystwyth.

There are some funky new and cool features to come. But this is a weblog-community in the making.

Rock on.

Hawaii

I’m scared. Kit is researching the laws governing marriage in Hawaii, and I’m not exactly sure why.

“Hey; you can get married at 15 in Hawaii!”

Meanwhile, I’m currently coding a wiki engine. For those of you who aren’t in-the-know, a wiki is a collaborative network of web pages that anybody can edit. They’re fun, if a little anarchic.

Back to the code…