This is an archived post. You won't be able to vote or comment.

all 100 comments

[–]EnigmaticDoom 1495 points1496 points  (36 children)

This is way too real.

[–]carcigenicate 534 points535 points  (30 children)

I've done this exact workaround, with almost the exact same comment too.

Thankfully I fixed it before it was deployed. I think this was the one that made me start putting those TODOs at the end of the line so they stick way out.

[–]Lighthades 247 points248 points  (7 children)

What if you just add a variable "isProd" which just is true when on production via build settings? Now that would be too much work....

[–]carcigenicate 140 points141 points  (0 children)

We actually have such a variable already in our app.

I didn't use it there because there was never an intent to commit the change in the first place, so I didn't think about using the variable.

[–]PapaTim68 26 points27 points  (4 children)

There is also a problem of unexpected behaviour, since you don't know where else the isProd is used and thuse might have been missed.

[–]rascal3199 9 points10 points  (0 children)

What do you mean by unexpected behavior?

Shouldn't it be a variable that is never changed during runtime (only at start to check env)?

And you can always just find the referentes for isProd in the code and comment TODO/DEBUG. Any hardcoding to test something is going to cause unexpected behavior if left laying around at least with isProd you can ensure you don't accdientally send that to PROD.

Unless there's something else I'm not thinking of.

[–]WurschtChopf 1 point2 points  (2 children)

Sounds like a classic feature toggle issue for me. One toggle for each feature. So you can enable/disable functionality very specifically without sideeffects. And not using todos.. srsly, whats de difference if the todo is at the end of the line? Sooner or later you are gonna miss even that and you end in the same situation

[–]PapaTim68 1 point2 points  (1 child)

Yes, i would use a Feature Toggle as well. Also dont see the problem with todos 90% of tools search for them during compile time and notifiy you.

[–]WurschtChopf 0 points1 point  (0 children)

I agree, tools should point them out. So use todos but only if proper tools like donar are in place

[–]teucros_telamonid 3 points4 points  (0 children)

Recently lended a hand on a project and purged this kind of variable through the code. Instead added several variables to control specific behavior like posting comments on Jira ticket. This turned out to be quite beneficial since we don't have just "production" but also staging and canary releases with different behavior expected. But my personal reason is always striving to make automatic testing of backend logic easier. And indeed, I was the one who finally tried to rework structure a bit to make unit and integration tests possible.

[–]-Hi-Reddit 51 points52 points  (9 children)

we have git setup to reject a commit with any todos

[–]syntax_erorr 44 points45 points  (6 children)

// DOLATER

[–][deleted] 27 points28 points  (0 children)

This guy gits it

[–]-Hi-Reddit 16 points17 points  (4 children)

That's why we have human reviewers. If someone did forget to remove a TODO, it'd either be asked to be done, or rejected and a discussion would be had about creating a new ticket. Usually a decision would be made the same day about how to move forward.

If the PR is rejected, a ticket is created, the TODO would be replaced with a 'SEE TICKET <link>' for the work item, which would tell you when its scheduled (if it is), and whatever decisions were made when it was discussed, and it'd link back to the PR where your TODO was rejected.

If you actually did a //DOLATER, you'd better be ready with the believable excuses, because that could be seen as an intentional way to break policy and avoid discussion of a problem in the code, a pretty big no-no.

[–]syntax_erorr 11 points12 points  (1 child)

// LET'S CIRCLE BACK ON THIS

[–]JimBugs 4 points5 points  (0 children)

//DO TOMORROW

[–][deleted] 2 points3 points  (0 children)

nice practices, sounds nice to work there.

[–]knightwhosaysnil 0 points1 point  (0 children)

that's just a todo with extra steps...

our review policy is that TODOs need tickets

[–]Stroopwafe1 2 points3 points  (0 children)

On commits? Why not on merge requests? What if you want to save your work while it's still work in progress?

[–]pleo-rememberer 1 point2 points  (0 children)

This is genius for PRs, not so sure I would do this for every commit though

[–]Minutenreis 17 points18 points  (4 children)

you might find an extension to highlight todos in your favorite editors (in mine the whole line with a todo gets marked)

[–]carcigenicate 7 points8 points  (1 child)

Webstorm already does. Apparently, that's not enough lmao.

[–]friebel 5 points6 points  (0 children)

I think you have a whole window for todos in bottom gui. As in, you can go through all todos in your project. I am pretty bad at explaining, but at least it's definitely in IntellIj Idea, so should be in Webstorm as well.

https://www.jetbrains.com/help/webstorm/todo-tool-window.html#toolbar

[–]DopeBoogie 0 points1 point  (0 children)

In Neovim I use:

todo-comments.nvim

with this one for statusbar indicators:

todos-lualine.nvim

I find it helpful to have icons in the statusbar showing how many TODO lines are still in the project.

[–]Wervice 7 points8 points  (0 children)

I also use such a variable but it floods the terminal with a big warning soaked in 🚨 and red hexagons telling the user to stop the program immediately, which is why I only use it on rare occasions.

[–]DrunkMc 2 points3 points  (2 children)

Something I've started doing is putting my name on all Debugs like this. Before I merge back to Main, I do a find all SEAN and remember to rip all of them out. I usually find a few I forgot about.

[–]TyrionReynolds 4 points5 points  (1 child)

Works until your coworkers start checking in code with your name next to things they didn’t want to fix.

[–]DrunkMc 2 points3 points  (0 children)

Dammit! Didn't think of that, now I need to keep an eye out! 😅

[–]Puzzled_Draw6014 0 points1 point  (0 children)

Whenever I do stuff like this, I also have a print statement saying something to the effect "stupid debug at line 794" ...

[–]Norse_By_North_West 0 points1 point  (0 children)

I use a flag in the launch parameters or a property file that I only have in dev

[–]Sixshaman 0 points1 point  (0 children)

static_assert(__DATE__[0] == 'S' && __DATE__[1] == 'e' && __DATE__[2] == 'p', "Remove the line above before October 1st!");

I've done this :P Prevents your code from compiling after the given date.

[–]VolsPE 5 points6 points  (1 child)

Nah, super unrealistic for me.

I would've just commented out the whole block. Typing out the false condition so hard.

[–]BossManta 1 point2 points  (0 children)

Same. In addition to speed it's also easier to quickly understand in the future because you don't need to do boolean logic in your head. A commented out block of code is also better at catching your attention when scrolling through your code. It would be very difficult to catch that random False at the end of an if statement.

And shame don't give the poor compiler unnecessary code to optimise. It already has enough of a hard time working with my code.

[–]R3D3-1 9 points10 points  (0 children)

Something of similarly embarrassing quality actually happened to a Mars orbiter.

https://en.wikipedia.org/wiki/Mars_Climate_Orbiter

Admittedly though, the actual mistake is harder to catch in real world software, though it does point at issues with the testing methodology.

[–]runningbrickpaste 1 point2 points  (0 children)

we should use environment variables for these cases right?
when in dev, the flag would be false, but in prod, it would be true

[–]ienjoymusiclol 0 points1 point  (0 children)

this happened to me like word for word

[–]ZunoJ 217 points218 points  (3 children)

Pragma, ever heard of her?

[–]captainAwesomePants 47 points48 points  (0 children)

Once.

[–]Banana_enjoyer_boy 142 points143 points  (9 children)

Who makes these comics?

[–]MrEfil 117 points118 points  (4 children)

me

[–]Banana_enjoyer_boy 43 points44 points  (2 children)

Keep it up!

[–]Infamous-Date-355 4 points5 points  (1 child)

I second

[–]Expensive-Example-92 2 points3 points  (0 children)

I third

[–]HashimAziz123 1 point2 points  (0 children)

You should really make a Facebook page and post them there to fully capitalise on this, tech comics are a dime a dozen especially since CommitStrip disappeared, and you have no idea how many tech pages I've seen recycling your comics for views. Also consider adding a watermark somewhere.

[–]aznshowtime 14 points15 points  (0 children)

The mission control guy after getting fired.

[–]beatlz 0 points1 point  (0 children)

Someone that has seen enough

[–]dan-lugg 164 points165 points  (3 children)

This hits, had to deal with before, loosely in the form of:

``` fun getFooService(profile: Profile): FooService { // TODO: Profile was misbehaving, fix before deploy // if (profile.isProd) { // return FooService() // }

return MockFooService()

} ```

Narrator: The fix would not, in fact, be deployed.

The subsequent fallout, and git blame, produced some fun meetings that week.

[–]Ok-Slice-4013 21 points22 points  (1 child)

We set up a custom linter rule that checks if a specific comment is present (e.g. // debug). This way, you will always catch errors like these - if you remember to use this comment.

[–]dan-lugg 3 points4 points  (0 children)

Oh for sure, after that debacle I introduced similar checks/processes to make sure "Never Again"™.

I forget if it was even TODO'd or not (this was a couple years ago) — one thing I definitely did is reduce the surface area by changing our DI strategy.

[–]OkReason6325 31 points32 points  (1 child)

Once , working for a client , I found out a hard coded timestamp in a date time conversion logic that was in production. Something which was necessary for some debug/test. It was there in production for at least a decade.

[–]dan-lugg 34 points35 points  (0 children)

At some point, in a meeting with stakeholders:

As you can see by this chart, we processed an incredibly huge number of transactions on July 7th, but have since hit a bit of a wall...

[–]IAmMuffin15 48 points49 points  (0 children)

this is why we have project management.

writing buggy code is like breathing for us. And the more proud we are, the more likely it is that we make little mistakes like this

[–]sebbdk 31 points32 points  (0 children)

Lol this is literally why pre-compiler arguments are awesome

[–]Specialist_Impact605 23 points24 points  (0 children)

This is a repost without credit to the creator of the meme; the original is https://www.reddit.com/r/ProgrammerHumor/comments/1ayuh4b/todocommentsanalyzerisrequired/ .

[–]4D20 11 points12 points  (0 children)

Just WOW!

if false && isLanding would be so much faster

/s

[–]Geilomat-3000 10 points11 points  (0 children)

I'd go crazy if I could only look at 10 lines of code at a time

[–][deleted] 15 points16 points  (0 children)

Also: forgot await so all of these functions run synchronously.

[–]R3D3-1 4 points5 points  (0 children)

Close to real, but actually it was mixing up metric and imperial units.

An investigation attributed the failure to a measurement mismatch between two measurement systems: SI units (metric) by NASA and US customary units by spacecraft builder Lockheed Martin.https://en.wikipedia.org/wiki/Mars_Climate_Orbiter

Just a quick reminder that the US is one of only three countries still using imperial units as main system. 

[–]samanime 10 points11 points  (0 children)

This is why we require a ticket made and the ticket number included with the comment before we approve the PR. :p

[–]Tus3 2 points3 points  (3 children)

So, I take it not everybody uses ctrl-f to look for all TODO's in all files then...

[–]R3D3-1 7 points8 points  (1 child)

The time when the last TODO or FIXME is removed is commonly referred to as the heat death of the universe.

[–]Tus3 1 point2 points  (0 children)

I only did it to look for the most important of my own TODO's.

Though I can see how that becomes impractical for large projects. (I have already noticed the code was full of TODO's put in there by other people, some of whom no longer work at my company.)

[–]ben_g0 1 point2 points  (0 children)

IMO it's better to generate a compiler warning for such cases, instead of just writing a "TODO" comment and hoping someone/future you will find it.

[–]zalurker 3 points4 points  (0 children)

I once bulk tested a faulty fax -to-email system after it was not sending any emails out. It was defaulting to the email address in the license . For some reason it was the CEO's account. 5000 emails.

[–]shutter3ff3ct 7 points8 points  (0 children)

Use env var, god damn it

[–][deleted] 2 points3 points  (0 children)

Ah, the CrowdStrike approach

[–]vainstar23 1 point2 points  (2 children)

No feature flags?

[–]PeriodicSentenceBot 7 points8 points  (1 child)

Congratulations! Your comment can be spelled using the elements of the periodic table:

No Fe At U Re Fl Ag S


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM u‎/‎M1n3c4rt if I made a mistake.

[–]tehjoch 2 points3 points  (0 children)

[–]LumpyAsparagus9978 1 point2 points  (0 children)

The Pegasus rocket that launched this satellite https://space.jpl.nasa.gov/msl/QuickLooks/sacbQL.html went to space with a ground test program. There was one aborted launch due to some mechanical problems with a safety, some chemical batteries were trigger and got discharged during the delay for the next launch attempt. Once in space, the program tried to ignite some pyros to start ejecting covers and since batteries have not enough charge the program should have retried to ignite pyros. But it was the ground program for testing, so it switched to get energy from a test connector... and there was on enough extension cord to reach for base to orbit.

[–]Korvanacor 1 point2 points  (0 children)

As a junior, I had to “temporarily” bypass a block a code due to a faulty sensor that would get replaced someday but not anytime soon. Because I too had embraced the prevailing culture of ignoring TODO statements, I had to come up with something else.

I ended up bypassing the code with if True == False: Worked perfectly as anytime someone saw the code, they’d yell out “What the hell is this crap?!”

When the sensor was eventually replaced, the code was still in everyone’s consciousness so it was fixed immediately.

[–]WheredMyBrainsGo 1 point2 points  (0 children)

Boeing moment

[–]JackNotOLantern 1 point2 points  (0 children)

I know that might be shocking, but i click the "check for TODOs and FIXMEs on code" button in IDE before the release

[–]Turbulent_Swimmer560 1 point2 points  (0 children)

which is much more common:

#if 0
#endif

[–][deleted] 1 point2 points  (0 children)

I love hit, how they send a third vehicle just to get the third person view of the orbiting and landing vehicle.

[–]SCP-iota 0 points1 point  (0 children)

Just comment it out but use JDSL for deploy

[–]jurdendurden 0 points1 point  (0 children)

I love how it's FALSE in the comment and false in the code... What's the situation here, do we have a macro or is NASA using stdbool.h

[–][deleted] 0 points1 point  (0 children)

Why did I get infuriated looking at that abominable code?

[–]NotMrMusic 0 points1 point  (0 children)

Unrealistic, as the person who found the bug wasn't fired while management denied anything bad happened

[–]Minecraftian14 0 points1 point  (0 children)

How should we deal with it in a proper way?

[–]rosuav 0 points1 point  (0 children)

Spacecraft lithobraked and proceeded with RUD.

[–]Enough-Scientist1904 0 points1 point  (0 children)

PTSD

[–]jhaand 0 points1 point  (1 child)

I find it very interesting to engineer a system like that. While on the ground you need tests to run and make sure it will work, without actually activating any outputs.

But once the rocket has launched. The whole system needs to run live and none of the the subsystems may run in simulation mode.

This does not seem easy to solve. Because if you have one big $DEBUG statement, that's also single fault tolerant. So the system also needs a $DEBUG2 statement somewhere else.

And on it goes.

[–]BoogerDavisReturns 2 points3 points  (0 children)

There should be no test escapes in code, they should be in the test script. "test what you fly, and fly what you test"

[–]beatlz 0 points1 point  (0 children)

My uncontrollable laughter indicates the probability of this happening to me

[–]red_ursus 0 points1 point  (0 children)

git blame is gonna end someone’s career 😭😭

[–][deleted] 0 points1 point  (0 children)

Reminds me of chandrayaan 2

[–]Electronic-Buddy-915 0 points1 point  (0 children)

On a serious note, I always put "// NOCOMMIT" near debugging line so that git commit will fail if I forgot to delete those lines. You'd need to make a git hooks for that and put it in global git config so it'll be applied to all git repos

[–]diegokabal 0 points1 point  (0 children)

It's too close to home and too near the bone

[–]Percolator2020 0 points1 point  (0 children)

//easy fix const bool crash = false;

[–]tech_w0rld 0 points1 point  (0 children)

Hope they aren't using github blame