Journal Articles

CVu Journal Vol 28, #3 - July 2016 + Programming Topics
Browse in : All > Journals > CVu > 283 (8)
All > Topics > Programming (877)
Any of these categories - All of these categories

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: The Codealow

Author: Martin Moene

Date: 06 July 2016 20:51:56 +01:00 or Wed, 06 July 2016 20:51:56 +01:00

Summary: Pete Goodliffe presents a new software soliloquy.

Body: 

The parents among the C Vu readership will no doubt be aware of The Gruffalo [1]. Many of us have read this book over and over (and over) again to excited children who enjoy the meter of the writing, the humour, and the cunning triumph of the humble protagonist in the face of larger aggressors.

If only life was like that. Especially the life of the humble jobbing programmer.

Who says life can’t imitate art? To prove this, here is a short code parable, presented for your enjoyment, with apologies to Julia Donaldson. I first presented this at the ACCU 2016 conference in Bristol.

The Codealow

A DEVELOPER’S BEDTIME STORY

A dev started work on some deep, dark code.
A bug saw the Dev, and the Dev looked good.
Come and waste time in my erroneous ways;
With the fun I can give, You’ll be stuck here for days.

That’s terribly kind of you, bug, but no;
I’m off to fix a codealow.

A codealow? What’s a codealow?
A codealow! Why didn’t you know?
It has terrible branches, executed at will
And disastrous uses of do/while/until.

I’d not heard of that, and it sounds very scary.
I’d best run and hide or I’ll look ordinary!
And, saying that, the bug turned and resigned,
Leaving code behind that worked just as designed.

Silly old bug, doesn’t he know
There's no such thing as codealow?

~

On worked the Dev, with a satisfied smirk.
A team lead saw our Dev, thought he needed more work.
Put down that editor, don’t write to that log!
Come take some tasks from my growing backlog.

I’d love more to do. I’d gladly help, though
I’ve plenty of work with this huge codealow.

A codealow? What’s a codealow?
A codealow! Why didn’t you know?
It has multi-thread access prone to data race,
And foul unused methods all over the place.

“No time to refactor!” The team lead then cursed
And went to find other devs’ lives to make worse.
As he scuttled off our dev chortled with glee;
The cunning ruse worked, he was management-free.

Silly old manager, doesn’t he know
There's no such thing as codealow?

~

On worked the Dev, having fun with his code
As an ominous feeling appeared and then growed.
Things that seemed perfect had gradually soured.
Strange bits of logic made our hero turn coward.

What is this weird code... how now to keep coping?
Who wrote this drivel, and what were they smoking?

It has functions so lengthy you’d get lost for days,
And logic that weaves in remarkable ways.
It has surprising behaviour that no one predicts,
And dense, turgid code, that no one tries to fix.

It has legacy parts that are old as the hills,
Whose evil required both malice and skill.
The cohesion and coupling have become a disaster;
There’s no way to get at the clean code I’m after.

The sad thing the source control points out quite clearly:
There’s only one person who spent time in here, and he
Ought feel shame-faced, he ought to feel guilty.
The nefarious culprit who made this mess is: me!

Oh help! Oh no! I wrote a codealow!

~

At this monstrous mistake the dev ran in despair
And learnt that next time he must code with more care.

~

A dev started work on some brand new code.
The dev wrote a test, and the test was good.

Reference

[1] The Gruffalo. Julia Donaldson, Axel Scheffler ISBN: 9781509804757

Notes: 

More fields may be available via dynamicdata ..