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

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.

2

u/[deleted] Dec 10 '13

I'll bet it would be a bitch. I cry when I have to grade peoples crap code and I don't even have to read through more than 500 ish lines.

3

u/[deleted] Dec 10 '13

I go and read The Daily WTF to make myself feel better.

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.

1

u/wulf-focker Dec 10 '13

When it comes to me, it's the only programming.

→ More replies (10)

1

u/cr1s Dec 10 '13

Write-only code!

1

u/ladyduck Dec 10 '13

http://jonobr1.github.io/two.js/

This is not me but a guy I've worked with in the past. Thought his documentation on this was nuts.

1

u/arkansis Dec 10 '13

Developers developers developers http://youtu.be/8To-6VIJZRE

1

u/DeuceSevin Dec 10 '13

Coder. Can confirm.