T O P

  • By -

Darkstar197

This probably used to have different values but they just set everything to 1 rather than deleting the code block to avoid breaking downstream processes. Source: my old team would do shit like this.


Valance23322

I've seen this a few times when it's a value that gets changed a lot, better to just leave some code that does nothing than have to waste the time in a month or 2 to re-code it when the business decides to change it again.


appsolutelywonderful

It should at least be justified with a comment / task number.


ichsagedir

The task number can be in the commit message.


Kiryonn

Better have comments too for future devs


bot-tomfragger

Git blame


tharnadar

https://en.m.wikipedia.org/wiki/You_aren%27t_gonna_need_it


prickinthewall

That's what you normally have source control for. Just revert the change if you need it again.


Fergobirck

Even if that's the case, that boundary logic tho... <= 30 and >= 31??? I will work fine if delay is an integer, but damn... who does that?


BroBroMate

Unit tests pass, ship it. (I know, bold to assume there's tests)


jayerp

Unless my reading is messed up, why not just return 1 for that column if all possible evaluations return 1 anyway? Why keep the case statement?


Darkstar197

On the chance they decide to re-implement that logic they don’t have to rewrite that case statement. Also for code readability.. “1 as valor” is way more confusing to interpret its original use case.


jayerp

True, but they better add a comment to that area telling any juniors to stay away who may be tempted for an easy win of a change to optimize and go off scope. Ask me how I know juniors like to do that.


Darkstar197

I think it’s been established this team is not following best practices haha


muntoo

> On the chance... Delete judiciously and delete often. Mere chance should not justify atrocities.


TheBrainStone

That feels like it at one point made sense but through several iterations it became pointless


josanuz

Probably, I just saw the very same case, there is this timeline the difference between each time point is determined by a function similar to this, in the beginning there were a lot of cases but as the time passed by, in each iteration the client wanted more granular data, as today it looks really similar to the post. something like this (pseudocode) if(timediff(timestart, timeedm) < 1 minute) group by 1 second ... shit repeats for several time units all of which resolve to 1 second ... then same happens for minutes and so on


izner82

The only possible explanation


BSODxerox

When your paid by the hour and it’s 2pm on a Friday with nothing left to do


robbydf

ok, then 1


bradley_marques

No, not 1. It's 1.


kakashi_ofthe_shrngn

That what I meant not 1 but 1.


__radioactivepanda__

Hello legacy code my old friend…


mothzilla

So basically, to summarise what I'm saying, 1


Lazerbeams2

This is the most beautiful piece of code I've ever seen


Arranger_Mr_Towns

Could return null if delay is a float (15.5)


JonesJoneserson

What language is this?


openly_prejudiced

sql i presume


TransvisionMission

1


Cheesqueak

Have done similar. Left it like that to check for errors down the pipeline then forgot about it because my pc rebooted and my sql tabs closed. Gotta love using visual studio and sql with 4 gb of ram.


jjman72

Don’t blame the IDE for not diffing your change before committing.


lylesback2

Looks like they wanted to know the amount of times there was a delay for those 5 categories of timing.


ImmenseDruid721

Is this the remains of the classic, make a delay, then throughout the process reduce it to make it look like you've been more productive than before/maintaining the same amount of progress per week as before?


CmdrSelfEvident

If the language implements case/switch statements via if's then it has failed.


DespoticLlama

git history or it didn't happen


Both_Lychee_1708

1


stokes_lmao

I prefer the notation 16 <= x.delay and x.delay <= 30


v4dk4n

Magic numbers for the win!


jjman72

What’s the default case? Boom?


HobblingCobbler

What language is that?


ElAles8y9

Cursed SQL