Categories
Professional Programming

Put Your Design in Writing

Writing up the design of a software system boosts productivity because it’s much less effort to fix bugs in the design before you write a line of code.

Since John ranted about ranting this week, I almost let out a get-off-my-lawn rant about how the kids these days don’t know about working out a design in writing before coding. Then I remembered that I only know a little bit of everything there is to know, but I am convinced it’s best not to give any energy to anything I don’t want more of.

Of the many subjects I studied years ago when earning my degree in computer science, software engineering persists as the most useful. I can barely recall how to code in Ada or Pascal, but I often return to the principles of discovering requirements, putting software design down on paper and planning for the entire system life cycle. I still keep those textbooks on a shelf in my office. I have a fond feeling about them similar to the one I get from the first edition Dungeon Masters Guide. Something nudges me to crack open those old books because there’s bound to be some wisdom I missed before.

I was thinking about Software Engineering Concepts by Richard Fairley as I read a blog post titled “Waterfall” doesn’t mean what you think it means. That post focuses on the misconceptions of waterfall versus agile. Perhaps the amorphous thing that people call agile enables the neglect of proper documentation. Although, I’ve observed this behavior long before anyone had a fashionable label for their lack of process.

Although I learned of the power of working up a design in writing while in class, the practice proved itself over the years. The argument is simple — it’s much less work to fix a flaw in the design when it’s just words and diagrams. Coding is comparatively more expensive, especially if you must throw away hours of work to start over. This might not be obvious to everyone.

Here’s my understanding of the software engineering process.

  • Discover the purpose of the system by writing down stories about how users will interact with it. Write them as non-technical stories that the client can understand.
  • Describe the data model, again in plain language. Validate the data model versus the user stories. Possibly add more stories and expand the data model. A data flow diagram can help. Describing operations between the data objects can help.
  • Write down any constraints you can think of. Some are obvious, such as when you know you’ll code the system in PHP because it’s the language you’ve been coding in for more than 25 years. Some constraints are standard, such as response times or maximum simultaneous users. Constraints can cause you to discover new user stories or to adjust the data model.
  • Describe the most important algorithms, database structures and objects. It isn’t code yet, but you’re thinking about how it would be coded and teasing out problems that might come up as the parts interact. It may cause you to return to any earlier step and revise your thinking, but that’s easy because it’s just words.
  • Figure out how you will test the system once it’s complete, otherwise known as a test plan. Figure out how the system will be maintained over time, otherwise known as a maintenance plan.
  • Start writing code, including unit tests. Keep validating that the code you’re writing honors the design. Write code that can be tested with the test plan. Write code that can be maintained. Revise the plans if necessary.
  • Run the test plan. Hopefully, unit tests were all passing and nothing major pops up that will cause a change in the design.
  • Deploy the system and stick to the maintenance plan. If you discover a flaw in any of the previous work, update what you wrote before.

Quite often, I see the above process compressed into a Statement of Work written up by a non-technical client, a list of tasks brainstormed in an hour for the purpose of estimation, and then a lot of churn on closing tasks. It’s easy, like wolfing down a bag of chips. Of course, it can give you indigestion or worse if you go back for seconds or thirds or …

Categories
Creative Pursuits D&D Poems

More Spell Rhymes

Here are more short rhymes for spells, this time those for the first level cleric.

Cause Fear

Thy weakened will is torn away.
Flee, you coward, without delay.

Cause Light Wounds

Come black shadows, the sun descends.
Embrace the darkness without end.

Cure Light Wounds

Let holy light hold back death.
Mend the wounds and calm the breath.

Darkness

Ebon cloak of obscurity
Descend on eyes that none may see.

Detect Evil

Now I pray my eyes to see
Any evil threats to me.

Detect Magic

Holy patron, if it's present
Make magic incandescent.

Light

Eternal light that shines from high
Illuminate as bright as sky.

Protection from Evil

Within this circle I am secure.
Summoned evil must abjure.

Purify Food and Water

Banish all impurity.
This food and drink will nourish thee.

Remove Fear

Though fearsome shadows doth appear
Our hearts are troubled not by fear.

Resist Cold

Let inner warmth be never lost.
Resist the hands of chilly frost.

Update: see more Rhymes for Spells.

Categories
D&D Poems

Dungeon Shanties

Players in adventure games (TTRPGs) behave much like pirates. They probably should sing songs about their experiences.

Dead Companion

(Sung to the tune of Drunken Sailor)

What can you do with a dead companion?
What can you do with a dead companion?
What can you do with a dead companion,
Deep down in the dungeon?

Chorus
Run, run, run for the exit!
Run, run, run for the exit!
Run, run, run for the exit
Deep down in the dungeon!

Heave him out and bury him proper
Heave him out and bury him proper
Heave him out and bury him proper
Deep down in the dungeon!

Chorus

Loot the body and let it rot there
Loot the body and let it rot there
Loot the body and let it rot there
Deep down in the dungeon!

Chorus

Feed him to your mates as iron rations
Feed him to your mates as iron rations
Feed him to your mates as iron rations
Deep down in the dungeon!

Chorus

That's what we do with a dead companion
That's what we do with a dead companion
That's what we do with a dead companion
Deep down in the the dungeon.

Chorus
Categories
Creative Pursuits D&D Poems

Rhymes for Spells

When a wizard casts a spell, he utters a few words, perhaps a lone “abracadabra”, but more dramatically, a rhyming couplet or even an entire poem, as in “Double, double, toil and trouble; Fire burn, and cauldron bubble…” Here are a few rhymes for spells of the first level.

Charm Person

By this wink and by this smile,
My new friend I do beguile.

Darkness

Ebon cloak of obscurity
Descend on eyes that none may see.

Detect Magic

Cosmic forces arcane and divine
Illuminate thyself with pale outline.

Floating Disc

Invisible porter, hand like a plate,
Remain at my side and hold my weight.

Hold Portal

Portal, hatch, door, and gate,
Let no intruder infiltrate.

Light

Eternal light that shines from high
Illuminate as bright as sky.

Magic Missile

Missiles, missiles, one, two three,
Strike my foes unerringly.

Magic Mouth

Listen and watch, mouthy illusion.
Deliver my words upon instrusion.

Protection from Evil

Within this circle I am secure.
Summoned evil must abjure.

Read Languages

Jargon, gibberish, and obscure babble,
Decipher prose from scribble-scrabble.

Shield

Stop the arrow, stop the sword,
Magic shield, be my ward.

Sleep

Count the sheep of endless number.
Resign yourself to peaceful slumber.

Ventriloquism

I send my words without a trace
To speak as from another place.

Update: see more Rhymes for Spells.

Categories
News PHP Professional

WordPress After 20 Years

Twenty years ago, WordPress was released. A couple of months after that, the third edition of Core PHP Programming was published. I recognized the potential of PHP in 1997, and I found a switch to WordPress in 2003 to be “an interesting idea that would encourage me to write more content more often“. Today and for a long time, most of the Web has run on WordPress and PHP (and MySQL). I recall justifying PHP over Perl (or any number of other platforms that have come and gone). I recall justifying WordPress over other CMSs. Today, it’s hard to argue against either given the long track record of performance.

The primary argument I hear is that these tools aren’t fashionable. Well, it’s usually spoken like, “it doesn’t feel modern”. Yeah, WordPress is boring, as in, no one will think you’re crazy for picking it to build your marketing site. It is a completely reasonable choice for the typical site, and if you can’t find a plugin to cover some unusual feature you need, it’s easy to create one because the whole stack is open source.