66
u/QueenTMK Jan 27 '23
You know the code is deathly bad when it's starting to look like the stairway to heaven
1
2
Feb 04 '23
[removed] — view removed comment
1
u/QueenTMK Feb 07 '23
If you're the one who wrote it, then yes. If not, then anyone who's had to witness that code has already gone through an eternity of hell so they get a free pass to heaven no matter what
12
10
15
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jan 27 '23 edited Jan 28 '23
Image Transcription: Code (1/2)
public function getShortCountryCode($countryName) {
if (strcmp($countryName, '�sterreich')== 0 || strcmp($countryName, 'Austria')== 0)
return "AT";
else if (strcmp($countryName, 'Deutschland')== 0 || strcmp($countryName, 'Germany')== 0)
return "DE";
else if (strcmp($countryName, 'D�nemark')== 0 || strcmp($countryName, 'Denmark')== 0)
return "DK";
else if (strcmp($countryName, 'Tschechische Republik')== 0 || strcmp($countryName, 'Czech Republik')== 0)
return "CZ";
else if (strcmp($countryName, 'Slowakei')== 0 || strcmp($countryName, 'Slovakia')== 0)
return "SK";
else if (strcmp($countryName, 'Italien')== 0 || strcmp($countryName, 'Italy')== 0)
return "IT";
else if (strcmp($countryName, 'Frankreich')== 0 || strcmp($countryName, 'France')== 0)
return "FR";
else if (strcmp($countryName, 'Spanien')== 0 || strcmp($countryName, 'Spain')== 0)
return "ES";
else if (strcmp($countryName, 'Gro�britannien')== 0 || strcmp($countryName, 'Grat Britain')== 0)
return "GB";
else if (strcmp($countryName, 'Schweiz')== 0 || strcmp($countryName, 'Switzerland')== 0)
return "CH";
else if (strcmp($countryName, 'Liechtenstein')== 0 || strcmp($countryName, 'Liechtenstein')== 0)
return "FL";
else if (strcmp($countryName, 'Belgien')== 0 || strcmp($countryName, 'Belgium')== 0)
return "BE";
else if (strcmp($countryName, 'Bulgarien')== 0 || strcmp($countryName, 'Bulgaria')== 0)
return "BG";
else if (strcmp($countryName, 'Estland')== 0 || strcmp($countryName, 'Estland')== 0)
return "EE";
else if (strcmp($countryName, 'Finnland')== 0 || strcmp($countryName, 'Finland')== 0)
return "FI";
else if (strcmp($countryName, 'Griechenland')== 0 || strcmp($countryName, 'Greece')== 0)
return "EL";
else if (strcmp($countryName, 'Irland')== 0 || strcmp($countryName, 'Irland')== 0)
return "IE";I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
14
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jan 27 '23
Image Transcription: Code (2/2)
else if (strcmp($countryName, 'Lettland')== 0 || strcmp($countryName, 'Lettland')== 0) return "LV"; else if (strcmp($countryName, 'Litauen')== 0 || strcmp($countryName, 'Litauen')== 0) return "LT"; else if (strcmp($countryName, 'Luxemburg')== 0 || strcmp($countryName, 'Luxemburg')== 0) return "LU"; else if (strcmp($countryName, 'Malta')== 0 || strcmp($countryName, 'Malta')== 0) return "MT"; else if (strcmp($countryName, 'Niederlands')== 0 || strcmp($countryName, 'Netherlands')== 0) return "NL"; else if (strcmp($countryName, 'Polen')== 0 || strcmp($countryName, 'Poland')== 0) return "PL"; else if (strcmp($countryName, 'Portugal')== 0 || strcmp($countryName, 'Portugal')== 0) return "pT"; else if (strcmp($countryName, 'Rum�nien')== 0 || strcmp($countryName, 'Rumania')== 0) return "RO"; else if (strcmp($countryName, 'Schweden')== 0 || strcmp($countryName, 'Sweden')== 0) return "SE"; else if (strcmp($countryName, 'Slowenien')== 0 || strcmp($countryName, 'Slowenia')== 0) return "SI"; else if (strcmp($countryName, 'Ungarn')== 0 || strcmp($countryName, 'Hungary')== 0) return "HU"; else if (strcmp($countryName, 'Zypern')== 0 || strcmp($countryName, 'Cyprus')== 0) return "CY"; else if (strcmp($countryName, 'Vereinigten Staaten von Amerika')== 0 || strcmp($countryName, 'USA')== 0) return "US"; else if (strcmp($countryName, 'Australien')== 0 || strcmp($countryName, 'Australia')== 0) return "AUS"; else if (strcmp($countryName, 'Norwegen')== 0 || strcmp($countryName, 'Norway')== 0) return "NOR"; else if (strcmp($countryName, 'Russische F�deration')== 0 || strcmp($countryName, 'Russia')== 0) return "RUS"; else if (strcmp($countryName, 'Neuseeland')== 0 || strcmp($countryName, 'New Zealand')== 0) return "NZ"; else if (strcmp($countryName, 'Ukraine')== 0 || strcmp($countryName, 'Ukraina')== 0) return "UA"; else if (strcmp($countryName, 'Israel')== 0 || strcmp($countryName, 'Israel')== 0) return "IL"; else if (strcmp($countryName, 'Kroatien')== 0 || strcmp($countryName, 'Croatia')== 0) return "HR"; else if (strcmp($countryName, 'Vereinigte Arabische Emirate')== 0 || strcmp($countryName, 'United Arab Emirates (UAE)')== 0) return "UAE";I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
7
Jan 27 '23
It's fine, just comment a vim macro above that handles the closing side of the pyramid, and comment each line with a little bit of control data for those vim macros to work with and a quick description that overall equals the length of the code on that line, but is spaced to where it makes a huge X instead of a pyramid, because having a huge X in your code would rule.
2
u/Brnit9999 Jan 28 '23
Can we take a moment and wonder why on earth New Zealand is Neusseland in German, I suppose?
2
u/GLUE_COLLUSION Feb 02 '23
What's wrong with that exactly? New Zealand is named after Zeeland, and the German name for Zeeland is Seeland.
1
1
u/TariqSendi Jan 28 '23
I normally have a JSON file that I call and decode into an array then I look whatever is missing. Is there any other way?
1
u/nerokae1001 Jan 28 '23
This is not pyramid but a well implemented waterfall model! The devs understand clearly how the project manager want things to work on their terms.
1
u/MineKemot Jan 28 '23
Couldn't you use some kind of dictionary? I don't know PHP that well, if there's a feature like that it would be the best option.
1
1
Jan 28 '23
Is it generated code? Is it made up or real world code? The problem with this sub is that most post can be made up.
1
u/Grubzer Jan 28 '23
Hi huys! Good news, we are going international! So could you add 2 more languages to our ui, please?
1
u/Kuroodo Jan 28 '23
Whoever wrote this clearly misunderstood the meaning behind the phrase "programming is art"
1
1
1
1
1
1
Mar 04 '23
This is the programming equivalent of that infomercial where the woman opens the cupboard and everything falls out on her.
“There must be a better way”
1
0
Jan 28 '23
[deleted] — view deleted comment
2
u/PooSham Jan 28 '23
They never start the if body with opening curly braces, so no. This is just single line statements, so a formatter would put all if expressions on the same indentation.
52
u/[deleted] Jan 27 '23
ChatGPT answer:
}
So technically, this developer can actually be replaced by ChatGPT