TodoOrDie: The Best and Worst Idea I Ever Had

I built todoordie because I'm sick of my own nonsense

Why todoordie? Because I was fed up with my own pathetic excuses. You know them all -- those TODO comments you sprinkle into your code like fairy dust, with the firm intention of working on them "later"? Spoiler: "Later" is a mythological place that doesn't exist. It's like saying you'll finally organize your sock drawer -- cute, but never going to happen.

So I stopped lying to myself and built todoordie, a package that basically screams "DO IT OR DIE!" at my neglected TODOs.

Why this was the best and worst idea I ever had.

What even is todoordie?

todoordie is my personal code babysitter. It's a PHP package that turns those sad little TODO comments into ticking time bombs. You set a deadline or a condition -- and if you haven't fixed the problem by then, it throws an error in your face like a passive-aggressive coworker. I've seen similar tools in other languages and thought: "PHP deserves to suffer just as much." And voila, here we are.

Why did I create this monster?

Picture this: You're neck-deep in code, writing // TODO: Fix this later, feeling productive -- and three months later the comment is still there, grinning at you like a ghost from a bad horror movie. Forgotten TODOs pile up, and that's exactly how technical debt garbage accumulates. And I'm tired of telling myself I'll get to it "someday." "Someday" is the lie we tell ourselves to feel better about eating pizza for breakfast.

I built todoordie to be the annoying gym buddy I never wanted -- except instead of forcing me to do push-ups, it forces me to clean up my code. Deadlines? Conditions? All included. It's less of a tool and more of a life choice for people who hate themselves enough to actually get things done.

How to use todoordie? (Because you want to know)

First, you need to invite the chaos into your life. Open your terminal and type:

composer require vangelis183/todoordie

Boom! Welcome to accountability hell. Congratulations, there's no going back.

Instead of a sad // TODO: I'll do this someday, you can now write:

use Vangelis\TodoOrDie;
 
TodoOrDie::check("Fix diese Funktion, die so hässlich ist, dass dein Code weint", new DateTime('2024-12-31'));

If you don't fix the monster by New Year's Eve 2024, todoordie crashes your party with an error. It's like a New Year's resolution, except this time you actually have to keep it -- or die.

You can also set conditions:

TodoOrDie::check("Hör auf, diese veraltete API zu nutzen, bevor sie dich beißt", function() {
    return Config::get('app.version') > '2.0';
});

If your app reaches version 2.0 and you're still clinging to that old API like a childhood blanket, todoordie will mercilessly shake you awake.

Customization (Because I'm not a complete sadist)

I get it -- nobody wants production to explode because of a TODO error. That's why I made sure todoordie doesn't completely escalate in critical environments. By default, it only issues warnings in production environments instead of crashing everything. It's like your mom constantly reminding you to clean your room -- annoying, but not the end of the world.

But you can customize it as you wish:

TodoOrDie::check("Refaktoriere das, bevor es ein Eigenleben entwickelt", new DateTime('2024-06-01'), ['production' => 'warn']);

See? It's got your back. You can also combine deadlines and conditions for maximum self-loathing:

TodoOrDie::check("Aktualisiere die API-Aufrufe, bevor die Welt untergeht", new DateTime('2024-09-01'), function() {
    return Config::get('api.version') === 'v3';
});

Now it only escalates when both the deadline has passed and the condition becomes true. It's like a "Choose Your Own Adventure" book -- except the adventure is made of regret.

Fair warning: this is todoordie, not todo_and_happy_rainbows. Test it before you put it in production -- otherwise your codebase becomes a telenovela.

The real chaos I caused

Imagine you have this little treasure in your code:

// TODO: Diese Funktion refaktorisieren, bevor sie dich im Schlaf verfolgt

With todoordie, it becomes:

TodoOrDie::check("Diese Funktion refaktorisieren, bevor sie dich im Schlaf verfolgt", new DateTime('2024-03-01'));

When March comes and the thing is still a disaster, todoordie haunts you instead. Deserved justice.

Or you're sitting on old legacy code:

TodoOrDie::check("Entferne diesen Legacy-Code, der älter ist als das Klapphandy deiner Oma", function() {
    return Config::get('app.release') === 'stable';
});

Once your app reaches stable status, you have to throw out the fossil code -- or face the consequences. It's like spring cleaning, just with more swearing.

The conclusion of this madness

I built todoordie because I am my own worst enemy. This package forces me -- and you -- to finally clean up the mess.

Your future self might hate me for forcing you to fix that bug. But it will thank me when your code doesn't look like a burning dumpster.

So grab todoordie on GitHub at https://github.com/vangelis183/todoordie and turn your TODOs into "I DID IT" moments. Your code deserves it -- and honestly, so do you. Kind of.


Is your project drowning in technical debt? Contact me for a no-obligation consultation on code quality and refactoring.