She asked "if the IF condition fails it'll go to the ELSE part, what if the IF condition is successful and it still goes to the ELSE part? Have you validated that ? "
I had a whole bunch of suits on Client, our side, and Consultant side who wanted the project to "progress". They wanted me to validate my queries and why I had to wait for the server to come online to start the task?
My non-IT client manager jumped in and said "Oh he absolutely started and it's 20% done, but there were complications needing an additional 4hrs to do an end-to-end integration test." Budget approved and the suits literally patted themselves for moving the project along.
We had an api receiving json payload and there was a 5mb limit. Anything bigger was meant to return http 413 and rejected. Then that would be visible on the dashboard. If 413s go up we'd contact the customer and say "hey your files are too big".
One developer decided we were getting too many of those and decided to catch all 413's and return 200. You can probably guess the rest.
In a website written in for PHP3 and MySQL 4, there was a query that fetched all the orders in the database into an array just to call count($arr) for the pagination calculation. It was taking several seconds to open the page and they had previously increased the virtual server's memory to handle it. I fixed it after the SQL injections. They were the first priority when the site was handed over to me.
238
u/talbakaze Mar 02 '26
return recalculate()
return recalculate()
the comment stated that it had to be recalculated twice
138
u/RookieRedditter Mar 02 '26
I had a non-technical manager.
She asked "if the IF condition fails it'll go to the ELSE part, what if the IF condition is successful and it still goes to the ELSE part? Have you validated that ? "
78
u/robhanz Mar 02 '26
#define constAt the top of a header included by almost everything in the project.
67
u/JochnathKrechup Mar 02 '26
I once wrote:
return x => 100 && !(x < 100)
It works extra well :)
33
u/FooBarBazQux123 Mar 02 '26
I once wrote some Java code like this.
if (true) { … }
PM told me to do exactly the same as the Perl code I was porting, it was a business critical application.
30
u/ineffective_topos Mar 02 '26
Claude once wrote
result = check(...); assert(result || !result)17
u/ZookeepergameFew6406 Mar 02 '26
this.$refs[id][0].children[0] .children[0] .children[0] .children[0].classList.add(‘font-bold’, ‘text-green’)
No explanation why it was done like this.
12
u/HonkHonkItsMe Mar 02 '26
Sadly my previous self is responsible for this monstrosity. I am not that person anymore. This is from 2013.
$modules[$module['module']] = $module; unset($modules[$module['module']]['module']); // Woooo ....
Comment for good measure 😩
10
u/merRedditor Mar 02 '26
This tech lead is going to lead tech right off a cliff.
6
u/praisethebeast69 Mar 02 '26
hypothetically if you need things done in a certain order it could make sense, but I can't think of a code example for the life of me
6
u/TapRemarkable9652 Mar 02 '26
switch (😒)
{
case 🤣:
return(😁)
};
6
u/rootifera Mar 02 '26
We had an api receiving json payload and there was a 5mb limit. Anything bigger was meant to return http 413 and rejected. Then that would be visible on the dashboard. If 413s go up we'd contact the customer and say "hey your files are too big".
One developer decided we were getting too many of those and decided to catch all 413's and return 200. You can probably guess the rest.
5
u/SillyWitch7 Mar 02 '26
Thing is this actually can make sense if the if statement has side effects. It can be simplified sure, but it also works this way.
4
u/AwayMilkVegan Mar 02 '26
Something like this if (true ou condition ou condition)
And with and else after
4
u/SaltyInternetPirate Mar 02 '26
In a website written in for PHP3 and MySQL 4, there was a query that fetched all the orders in the database into an array just to call
count($arr)for the pagination calculation. It was taking several seconds to open the page and they had previously increased the virtual server's memory to handle it. I fixed it after the SQL injections. They were the first priority when the site was handed over to me.4
u/MrGoatastic Mar 02 '26
My Tech lead sent me http://localhost:8080 asking me if the dev environment was working for me or its down...
Yes.... It happened for real.. like the meme but on another level. In the meme at least the dude wasn't a programmer. Mine is .....
4
u/RootHouston Mar 02 '26
All the worst code comes from me five years prior to the day I'm reading it.
4
u/Outrageous-Crazy-253 Mar 02 '26
It’s so funny how tame this is by today’s vibecoded standards where you can have repos where 90% of the code literally never can be executed.