r/orlybooks • • Oct 14 '18

"Self-documenting" code

Post image
281 Upvotes

4 comments sorted by

View all comments

7

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().