Source Code Affirmations

Programmers stare at stubborn code bases all day long.  They work within the nuts and bolts of rigid logic, a world where everything is either exactly true or exactly false, or at least some quantized exact measurement.  Its a harsh world that we live in, but somehow we find ways to make it even worse for ourselves.  Not only do we write miles upon miles of ungrudging, unyielding conditions, branches, and decisively precise calculations we add insult to injury by injecting the source code with additional lines of absolutism designed more or less to document the more overarching exactness of the body of work.  These are the software asserts; statements and predicates laced throughout the code that we use to insure that our well thought out regiments are adhered to, to the letter.  We use them to make sure that the code never steps across that line, so we can know at all times the precise nature of the beast.

Seeing this day in and day out, over weeks and weeks, slowly builds up within our fragile programmer brains.  We start to doubt ourselves, about whether we as people can ever achieve that same perfect symmetry and rational behavior of the software system that we work with.  After all, we are only human beings, fallible, weary, weak.  The machine is everything we are not.  It makes you start to want to skip work all together, to throw in the towel.  I mean, how can you live up to that?

The only saving grace, I have found so far, is that there are bits and pieces of other things that also exist within the code, that we also see day to day, that are not so precise, are often irrational and many times blatantly wrong.  These are the source code comments.  You probably see them as often as you see assertions, though sometimes they don't exist at all, like my code.  I feel that I would do better to add more, then I'd be giving equal eye time to things that are less than perfect. 

Yet, even this is somewhat less than ideal.  I mean, its a comment.  The machine completely ignores it.  I would still find it hard to live up to the perfection of the machine knowing that it was smart enough to avoid these bits of human frailty.  So, I think the only way to continue in this field is to somehow get the machine to also accept these random things are part of the actual code, and at the same time boost our egos so we can still find the strength to get out of bed in the morning.

Software affirmations are just like assertions. They sit side-by-side with the rest of your code and compile down to actual instructions. 

void Foo(Blah x) {

   Debug.Assert(x != null, “Bad Parameter“);

   Debug.Affirm(You are doing a great job.  The testers like your work.  Keep it up.);

   return x.y * 10;


Now, wouldn't you like to greeted to this code every morning?

Comments (4)
  1. David Campeau says:

    This got me laughing aloud! This was a good one!

  2. Sean says:

    Unfortunately it wouldn’t be long before someone (prolly a Java developer or PM) came up with

    Debug.Debate(What’s wrong with you. Can’t you see that this is all wrong? It’ll be a cold day before this passes the test cases.)

    though I’d enjoy

    Debug.EmitAColdFrostyAdultBeverage(Long Island Iced Tea)

    (Hey, it’s friday night! 😉

  3. y is not defined. void functions cannot return a value.

  4. Matt says:

    Sure the code is broken, but doesn’t the affirmation make you feel good about it?

Comments are closed.

Skip to main content