Live data from Hacker News

Shit programmers write

shitprogrammerswrite.com

81–82 of 82 posts

Re: Shit programmers write

#81
post #78
post #7

Earlier quoted context omitted.

This reminds me of this one, which is quite common: return foo == null ? true : false;

I did something of this kind recently and it was to enforce more of an api in my object, like internally I call some low api method that either gives me the object I'm looking for or false / null when doesn't find it, but in my interface I don't want to leak that object, just true or false. So function isAvailable(){ objInDb = findByName('Joan Carlos'); // the object or false return objInDb ? true : false; } But all…

I this case, returning objInDb would be semantically different. So, if you always want to return a Boolean, you did the right thing.

Re: Shit programmers write

#82

Earlier quoted context omitted.

Just curious: Why does printing it on paper helps you to understand code better than reading it on screen?

It helps to understand the structure. I was looking for repetitions (and luckily I found a lot), but I needed to look out for things that change between repetitions. I just found the picture I took that day. The boxing gloves just happened to be in the same conf room. http://i.imgur.com/bQCA08C.jpg

Looking as close as I can at those printouts, my only reaction is, "that's CODE?!" Good lord.
Post reply on HN