r/technology • • Dec 10 '13

By Special Request of the Admins Reddit’s empire is founded on a flawed algorithm

http://technotes.iangreenleaf.com/posts/2013-12-09-reddits-empire-is-built-on-a-flawed-algorithm.html
3.9k Upvotes

2.2k comments sorted by

View all comments

Show parent comment

271

u/casualblair Dec 10 '13

You have a gun to your head. You will be killed if you don't hack the firewall in one minute.

BETTER PROPERLY COMMENT MY CODE LOL BEST PRACTICES MOTHERFUCKER

205

u/Torgamous Dec 10 '13

You'd better properly comment your code if someone's going to kill you after a minute of coding. You're dead either way, but at least the next programmer they bring in doesn't have to start from scratch.

90

u/cmasterflex Dec 10 '13

Might as well add some unit tests while you are in there, wouldn't want the next hacker to break anything.

9

u/real_actual_doctor Dec 10 '13

Faster! Hackers in other movies would be done by now!

4

u/Elite6809 Dec 10 '13

Should we add in a dependency injection framework, too?

→ More replies (1)

2

u/Chocrates Dec 10 '13

LOL, testing? This must be fantasy.

59

u/[deleted] Dec 10 '13

Q. How many programmers does it take to write the right code when a gun's placed to do their head?

A. None. On an average though you will find 87 programmers die before a programmer with martial arts shows up and breaks the hand that holds the gun.

4

u/Zeliss Dec 10 '13

The trick is to program in bullet-time.

3

u/EBartleby Dec 10 '13

Here is how to extract an easy 15$ from me: (free protip for the movie industry)

Make that guy's post into a movie. Steven Seagal is the 88th programmer. Have him clearly explain at some point that is an ex-Marine, cook, BUT ALSO a genius hacker.

''The 88th Hacker''

(Bonus protip. Tagline: ''He breaks bone and code with equal proficiency!'')

okok coffee time now enjoy the free money dudes

→ More replies (1)
→ More replies (2)

140

u/PsychoM Dec 10 '13

What do you call a developer who doesn't properly comment their code?

A developer.

133

u/hoodoo-operator Dec 10 '13

If it was hard to write it should be hard to understand.

9

u/rohanivey Dec 10 '13

"I spent hours on this. I wouldn't want to rob anyone else the of same experience."

8

u/You_meddling_kids Dec 10 '13

It's ok, that assembly code is totally self-documenting.

0

u/[deleted] Dec 10 '13

[deleted] — view deleted comment

4

u/[deleted] Dec 10 '13
 int a,b,c,d,e;
 string f,g;

You really want to fuck with someone write your code so you can understand it and it has lots of comments. Save it then refactor all of your variables to small random character names. find and replace all //* with " " then you send it to them.

3

u/[deleted] Dec 10 '13

Variables? Real programmers do a malloc(5000) at the beginning of every program and manually save all their data at random locations in there.

→ More replies (1)

2

u/[deleted] Dec 10 '13

The next time you have to work with code like that will be because the previous dev was an insecure arsehole who thought that was an ok thing to do.

2

u/[deleted] Dec 10 '13

I try to be polite and code well but then I am still in college.

2

u/[deleted] Dec 10 '13

Sorry, I'm a bit bitter because I've inherited obfuscated code a couple of times.

→ More replies (2)

4

u/wrgrant Dec 10 '13

How many times have you gone to fix a bug in something you were working on, and said to yourself "What the fuck was this guy thinking? No way this should ever have worked" ... then discover it was you who wrote it?

0

u/[deleted] Dec 10 '13

[deleted] — view deleted comment

14

u/Sarcastinator Dec 10 '13

These are the most common comments I find:

// TODO: Fix this. - [Someone who left years ago]
A thousand lines of very awkwardly written code;

// This function returns the sum
int Average() { return median; }

// What is this for? - [Code reviewer]

// Should have been somewhere else, but I'm lazy.
DirectDbCallInBusinessLogic();

// Do foo.
void DoFoo();

I'm not against comments at all, and in fact I think they are quite useful. But programmers need to stop making worthless comments, and update comments when they edit the code.

... unfortunately that includes myself.

2

u/fluffyponyza Dec 10 '13

There is only one truth, and the truth is in the code. In order to document that truth you must understand that code...and the path to enlightenment is not easy, brother.

6

u/[deleted] Dec 10 '13

And to be honest, sometimes we're not sure if or how it works either.

4

u/fluffyponyza Dec 10 '13

StackExchange cut-and-paste programming is the BEST programming.

→ More replies (1)
→ More replies (10)
→ More replies (1)
→ More replies (5)
→ More replies (6)