💾 Archived View for jsreed5.org › log › 2023 › 202307 › 20230706-avoiding-feature-creep.gmi captured on 2023-07-22 at 16:25:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-07-10)

-=-=-=-=-=-=-

Avoiding Feature Creep

2023-07-06

---

A few years ago I wrote a shell script to create and manage a local, Twitter-like "microblog" file. Though I don't use it often anymore, for a while I used that script to document all my thoughts and feelings in a micro-journal. The script is available in the "Files" section of my capsule--to this day the only script I've ever written that I feel confident in sharing publicly.

The script takes a single argument at the command line, namely the location of the timeline file. During creation of the timeline, however, the user specifies a username, and it does not have to match the name of the timeline file itself. Nothing in the invocation of the script reflects what the username might be. This is inconvenient if the script is ever deployed in a multi-use environment.

I've thought about before about how I might want to fix this limitation, and a few days ago I revisited the problem. The obvious course was to search inside timeline files for a given username, but the script is designed to have one timeline file per directory, so which directories should the script search? One option would be to change the script behavior to use a directory of user directories, and another would be to change directory structure to allow multiple timelines.

Every solution turned out to involve a lot of work and break existing script behavior in some way. Now that I've reached version 1, I really don't want to modify any core behavior if I don't have to.

After thinking for a few hours, I realized that what I was doing amounted to feature creep. I was taking a script that already did everything I fundamentally want it to do, and I was trying to add an optional feature that only was only hypothetically useful. There was no real reason to muddle an already-complicated script even further.

This realization led me to the actual solution I created: a second script acting as a wrapper for the first. The wrapper script has its own configuration file that stores a list of users and the timeline file locations for each user. Invoking the wrapper with a given username calls the microblog script with the timeline file associated with the username.

I enjoy the Unix principle that programs should do one thing and do it well. But when I start writing scripts and programs myself, I often fall for the temptation of adding more and more features. This exercise was a practical reminder for me that simpler is usually better.

---

Up One Level

Home

[Last updated: 2023-07-06]