Live data from Hacker News

Ask HN: what is the most stupid line of code you saw?

news.ycombinator.com

11–20 of 20 posts

Re: Ask HN: what is the most stupid line of code you saw?

#11
Old php site from year 2000.

Each line of HTML is generated like that :

$html.='';

$html.='';

$html.='The content';

$html.='';

$html.='';

The dev used this in every file, each file contain thousands of lines like that. Worst project i have ever seen, and i must work alone on it. FML.

Re: Ask HN: what is the most stupid line of code you saw?

#12
I remember in college, someone left his/hers C assignment source code in the lab (laptops were a luxury in that time).

The code was really awful, and that part hurt my eyes:

/* commented out code.

  and here was the code
  seriously
 */
At least (s)he knew what a block comment was.

Re: Ask HN: what is the most stupid line of code you saw?

#13
post #6

Followed by more php.

That's not bad code, it's just WordPress lingo you're unfamiliar with. http://codex.wordpress.org/The_Loop

I wish I were unfamiliar with it....

I think it is bad practice at least then, if not explicitly bad code, because it's needlessly overcomplicated. Why use the end tag when you're not switching contexts between php and html? After this line there's just another open tag and more code... it's a pointless way of writing php that makes it aggravating to read and edit.

Re: Ask HN: what is the most stupid line of code you saw?

#14
post #11

Old php site from year 2000. Each line of HTML is generated like that : $html.=' '; $html.=' '; $html.='The content'; $html.=' '; $html.=' '; The dev used this in every file, each file contain thousands of lines like that. Worst project i have ever seen, and i must work alone on it. FML.

I've seen this done with SQL queries all the time but... ouch.

Re: Ask HN: what is the most stupid line of code you saw?

#15
post #4

Java code if (obj instanceof java.lang.Object)

First, your answer is why I almost never criticize people's code:

This is (was in Sun's time) an actual possible certification question and you are wrong, this CAN return false:

        Object obj = new Object() {{ System.out.println(false); System.exit(0); }};
        
        System.out.println(obj instanceof Object);
Post reply on HN