Hacker News new | ask | show | jobs
by richrichardsson 2850 days ago
Hard to read? The sum total of the script fits on 2-3 pages at most, no single function exceeds about 10 lines, if you have trouble reading and reasoning about that code then something is wrong.
2 comments

functions will not be any line longer by writing ranks instead of rks, but it will greatly improve readability.

You can have the exact same code wihtout abbreviations, and I can assure you that it will still be 2-3 pages long, with very short functions.

You can't evaluate readability without knowing the conventions that a system is working with. (That means knowing something about the people as well, btw.)

In this system, 'rks' communicates something that 'ranks' does not: that this is a local variable denoting a collection, and that it is a collection of the things that 'rk' denotes one of. So actually it adds quite a bit to readability.

If I were going to edit that code to make it more readable, the one change I'd consider is using 'r' (or maybe 'n', because these are integers) instead of 'rk'. One can argue either way whether the k adds information or just noise.

Yeah, I also like to minify the code before reading. It makes up to 5 times less code and it's fun to guess which letter stands for which function.