25
Aug 03 '15
line 4500
6
u/Reelix Aug 03 '15
We have a "ui.js" for pretty much our entire site (Inherited from a third-party)
Currently sitting at 5,110 LoC
8
u/namtab00 Aug 03 '15
Heh peasant, I have a 6000 loc webforms page behind that I wrote... Truly ashamed of it, but the shame fades in front of the fact that none of my colleagues or management see anything wrong with it...
2
23
16
23
u/mrbaozi Aug 02 '15
Sweet Jesus! Maybe I'm missing something here, but why are all the conditions the same? Wouldn't this code simpy execute the first or last if statement?
23
u/gchpaco Aug 02 '15
There's a whole bunch of callbacks; the conditions could possibly have changed. But it's still pretty bad.
8
u/ZugNachPankow Aug 02 '15
Some functions could alter
htmlEncodeRegExoriContextTo, in which case the conditions would no longer be the same.Or they could throw errors or otherwise disrupt the control flow.
Or they simply need to be called in sequence, which is the reason why "callback hell" is a thing. This doesn't seem like callback hell, though, because there's no
errbeing passed.14
4
Aug 03 '15
Isnt this the definition of callback hell?
1
u/ZugNachPankow Aug 03 '15
I don't know, either someone has a very particular programming style, or they don't follow the callback standard (error first, then results).
1
29
u/steamruler Aug 02 '15
Set tabspacing to two spaces, crank your IDE coloring to the max, and start digging through it.
8
u/Booyanach Aug 03 '15
no
4 spaces
25
Aug 03 '15
4 spaces is for code that's legible with 4 spaces. Ideally, that's all of your code.
This code is not currently legible with 4 spaces.
3
u/IDOLIKETURTLES Aug 03 '15
It doesn't help my understanding of wtf is going on by changing the indentation to two spaces ... It's still a mess. This pile of shit needs a complete refactoring.
1
0
Aug 03 '15
[deleted]
3
u/barshat Aug 03 '15
Yes, Eclipse does have syntax highlighting and come cool "themes" that are supported by a plugin named Eclipse Color Theme. Link: http://eclipsecolorthemes.org/
10
6
u/bigpigfoot Aug 03 '15
if you nest it enough times, it resets the nest level back, making it really neat
5
u/RandomhouseMD Aug 03 '15
So, I worked at a place that brought me in to unfuck some of their code in preparation for them doing a site update. Their site (VB asp.net site ported from classic asp, with tools that were asp.net in C# along side it of course) had a handful of pages that were nested tables that were created by using office and "export to html". For the first and only time in my life, I had to deal with nested tables that actually indented so far that they wrapped to the next line in Visual Studio.
I was not unhappy to get to the end of that contract.
4
u/undergroundmonorail Aug 03 '15
One time a friend of mine was complaining about having to read code that looked like this to figure out how something worked. He said he would never trust the people who wrote it to code anything for him.
I later found out that he was looking at decompiled source code. I wonder why the style was garbage............
2
2
u/Daenyrig Aug 03 '15
Yo dawg. I heard you like nests. So I put a nest in your nest so you can read my nest in my nest in my nest in my nest in my nest in my ne- error occurred while generating redundant meme! Situation deemed too redundant to properly be meme'd. Please contact your local meme master for help.
2
2
1
u/Jonno_FTW Aug 03 '15
Damn, the worst I got was like 8 levels: https://github.com/JonnoFTW/ProjectEulerJava/blob/master/src/Prob61.py
1
Aug 05 '15
>ProjectEulerJava
>Python
I feel cheated, and then disappointed you did not abstract this into beauty. :/
1
u/Jonno_FTW Aug 05 '15
Well originally all my attempts were in Haskell.
1
Aug 05 '15
Coincidentally enough your code prompted me to try writing it in Haskell. I'll have to finish it another time though because I misinterpreted the problem (as usual with Project Euler, they should really stop wording their problems so terribly) and got frustrated. :P
Did you ever finish it?
1
1
u/SideburnsOfDoom Aug 03 '15 edited Aug 03 '15
I don't know what hurts the most, the indented ifs & callbacks, or the fact that it's on line 4500 of one file.
No wait ... the ifs & callbacks are worse.
1
1
0
72
u/[deleted] Aug 02 '15
This has to be generated right?