Can someone explain to a non-programmer whats wrong with this code?

can someone explain to a non-programmer whats wrong with this code?

Attached: 1647695020960.png (1000x950, 466.78K)

idk, it's ok I guess, maybe change to a switch or some ooptard shit

You don't even need to be a programmer to see how unoptimised this is. Sure, there's not much that could happen here but imagine if this same programmer applied this principle elsewhere in places where lots of calculations take place. Imagine the overhead of something like this when the code could also be written more elegantly, let alone take up less LOC.

>see how unoptimised this is. Sure, there's not much that could happen here but
code monkeys really are something else

Bad memory administration, ser

Don't worry, user, LoC is the longest running meme in the tech community. You'll be fine

branching is slow, switch cases use jump table structure, which is waaay faster

You can build the return string using a single regex by extracting the versioning at the end. Hence, there's no reason to create a 200+ line if-else wrapper for such. It would also be easier to maintain in the end.

Just separate it in name and version parts and check the version of it if the name is valid. And maybe you should also use a variable in that version part, just in case you add something else.

because you can just pull the numbers you want out of the string

Maybe, he isn't showing the whole thing, but yes, it is way simpler than this.

basically violates DRY (Don't Repeat Yourself)
if you find yourself copy/pasting the same thing over and over, slightly modified for different cases, odds are there's a better way to go about it.

>Someone manually typed all of that
>Even if he copy pasted it, if he typod once in the part of the string that he changed there's no way the compiler would know resulting in an unknown bug
>Matching strings is not as efficient

everything

Attached: 1631839603959.png (672x526, 66.01K)

Unoptimized and hard to read.

It's inefficient

>only three return statements allowed in function body
would give a warning in my PR

regular expressions

No idea. Clearly the compiler will detect that it is a switch over a bunch of strings and optimize it using hash comparisons and jump tables.
Surely Any Forums isn’t using an outdated language that would prevent the compiler from doing such a trivial optimization.

>compiler

(You)

>IT'S Ummmm.... inefficient!
This thread is really exposing all the retards who post on Any Forums. I didn't realize it was this bad until this thread.

>there are Any Forumstards who unironically defend this
ngmi

In what way is it more efficient

they cried in pain cause he was right

I'll bite
Python is interpreted and the problem is not performance but the way the code was written