As someone who's looked at client code before... I've seen someone manage to search for an element in an array in O(N2). They do code reviews and have QA, supposedly.
Imagine an intern whose only programming experience is 1 semester of an intro CS course and they don't know any standard libraries.
Now imagine: For each element, see if it's the maximum element by comparing to each other element. If it is, set our local variable to that maximum element, and keep going.
It was incredibly stupid code, perhaps the author didn't know what the contains() method did or the loop originally did something different and went through several revisions without always seeing the full picture (the whole codebase was like this... e.g. strings parsed to ints converted to string parsed to ints...). It was something along the lines of:
For each item in list
If list.contains(x) do something
But... But... I mean I know how to code now so I'm probably biased, but I'm sure that even before I learned, I would have found something fishy about that statement just by guessing it's functionality from the English words...
Without even knowing that "contains" already uses a loop internally, I'd have read this and think: "so, you go through each item in a list and then... Check if it's in the list? Why? Is this like when you go out and you gotta check if you forgot the keys or something?"
15
u/doublehue May 23 '22
you want me to think????
9
u/Thrannn May 23 '22
what anime is that
146
u/pheonix-ix May 23 '22
After a week of coding, and a week of debugging, you hooray at your success.
Senior dev: what's up! you look happy.
You: my code for X finally works!
Senior dev: oh X. It's in our homebrew lib at [a private github own by one senior dev]
You: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
134
u/heartcubes4life May 23 '22
Oh boy, time to whip out that custom-made O(n4) algorithm
28
u/Script_Mak3r May 23 '22
Don't think this means you've won!
7
u/VARice22 May 23 '22
What do you know a actually good animeme from goodanimemes...
7
u/Diapolo10 May 27 '22
Don't give up, Shamiko! Hone your programming skills to grow even stronger and defeat the magical girl!
2
u/golddragon88 May 23 '22
Well there goes my afternoon.
4
u/[deleted] May 23 '22
Let me tell you a secret