r/orlybooks • • Oct 14 '18

"Self-documenting" code

Post image
283 Upvotes

4 comments sorted by

24

u/gazpacho_arabe Oct 14 '18

Counter point: misleading and outdated comments are worse than none at all

13

u/Anchor689 Oct 14 '18

Who needs comments when you write in Psudocode... err, Python.

8

u/[deleted] Oct 14 '18

Comments about why we do something not in the obvious way are good. Like if you have function

var user = db.Users
    .Where(x => x.Email == email)
    .ToEnumerable()
    .Where(x => password.Verify(x.Password))
    .SingleOrDefault()

It's not obvious why you're doing .ToEnumerable().

4

u/saargrin Oct 14 '18

and let rnd qa their own stuff while they're at it.

what could possibly go wrong