Skip to content
The Shitty Dev

Report no. 0001

a.php, b.php, c.php...: the company that runs on an alphabet

In 2019 an IT guy who had just joined a company wrote some scripts in a hurry. The first was called a.php. They all still work and working out which does what takes a small leap of faith.

Severity
Hassle 2 out of 5
Dumbness
Reverse genius 4 out of 5
Category
Programming
Author
mazinthebox
Published
Reading time
3 min read

In 2019 an IT guy joined a company with a simple problem: everything that today takes one click was done by hand there. Company emails to manage, devices to check, tasks to repeat every day at the same time. He did what every IT person with little time and a lot of hurry does: he wrote a script.

He called it a.php.

"I'll rename it later"

The name was not a choice: it was a symptom. There was a hurry, the file had to exist right now and a is the fastest letter to type. He told himself, as we all do, that he would rename it later.

He never renamed it. In fact the next day a second script was needed, and by then the path was already set.

The naming system (if we can call it that)

The method was simple and, it must be said, perfectly consistent:

  1. Need a new script?
  2. Take the letter after the last one used.
  3. Do not write down anywhere what it does.

That is how b.php, c.php, d.php and so on were born, one for every new need: mail, device checks, cron jobs of every kind. Not a single name that said anything. Just the order of birth, like a registry where nobody has a surname.

And the worst part is that they work

This is the thing no best-practices course prepares you for: since 2019 the scripts still work. All of them. They do not break, they do not complain, they do not ask for updates. The latest one to go into service is called t.php.

If someone asks him what k.php does, the honest answer is: "give me a second, I'll open it and read it". Which is the IT equivalent of shaking a parcel to guess what is inside.

Meanwhile the crontab is a masterpiece of hermetic poetry:

*/5  *  * *   *    php /opt/scripts/c.php
0    7  * *   1-5  php /opt/scripts/a.php
30   2  * *   *    php /opt/scripts/k.php

Three lines, zero explanation. If one of them ever does something wrong, the investigation will start with a single question: which letter?

The countdown

The math is worrying. The alphabet has 26 letters, and they have reached t. There are six scripts left (u, v, w, x, y, z) before the question that keeps our IT guy awake: after z.php do we go to aa.php? Or do we start over and end up overwriting a.php, the first and oldest of them all?

Nobody wants to find out.

What this story teaches us

  • A name that says what it does. check-switch.php beats k.php in every possible and imaginable way. It costs ten extra seconds, once.
  • A comment at the top of the file. Three lines: what it does, how often it runs, who calls it. Three years from now, you will thank yourself.
  • A list of what runs and when. Even a text file. Better if it lives next to the crontab.
  • A folder per area. Mail, devices, maintenance. Not twenty files in a row.
  • Distrust the word "temporary". In IT it means "until retirement".

Sooner or later he will rename them all. He has been saying so since 2019.

Similar stories

Comments

No comments yet: be the first.

Write a comment

You can comment without signing up. Anonymous comments are reviewed before they appear. Please do not name people or companies.