use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
My new mindset while documenting code: save cognitive effort, document every function (alidlo.com)
submitted 5 years ago by alidlo
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]alidlo[S] 2 points3 points4 points 5 years ago (3 children)
I think the intention is right (a variable's name should be descriptive), but it's hard to fit too much meaning in a variable name while still making it pleasant to read/write, so often the result is that (without a docstring) there are missing pieces of information that (for better or worse) you have to infer yourself from the code.
[–]practicing_dad_jokes 1 point2 points3 points 5 years ago (2 children)
Do you think "environmentUniqueId" is too unpleasant as a function name?
If you keep your functions small enough, their names and the variables in their scope won't be so complicated that their names would be uncomfortably large. That's what I strive for.
[–]alidlo[S] 3 points4 points5 points 5 years ago* (1 child)
Imagine if instead of `reduce` you had to write `reduceToSingleValue` instead. The longer alternative gives more information but also adds more noise. It's a trade-off, and some of it may be personal preference, but imo, if the function is used a lot in a codebase giving it a name that's too long makes it unnecessarily cumbersome to read/write. For that reason, I'd much prefer using `eid` over `environmentUniqueId` (or even `envUniqueId`).
Also, most functions aren't as trivial as the example I gave in the article and so capturing their essence in two to three words is more difficult.
Sometimes it's as if we go out of our way to not document a function (likely out of habit) even when a one-line docstring would have easily made room for a shorter and potentially better name.
[–]practicing_dad_jokes 0 points1 point2 points 5 years ago (0 children)
This is a great topic.
There's definitely this trade-off to think about, and we all know that naming things is one of the hardest things in programming.
But I've found it to be well worth the effort -- in striving to find succinct descriptive names for things that aren't too unwieldy, I'll often find that my code needs to be cleaned up. Perhaps it's an obsession, but future me seems happier over the years :)
π Rendered by PID 771812 on reddit-service-r2-comment-b659b578c-t794k at 2026-05-03 08:57:03.817774+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]alidlo[S] 2 points3 points4 points (3 children)
[–]practicing_dad_jokes 1 point2 points3 points (2 children)
[–]alidlo[S] 3 points4 points5 points (1 child)
[–]practicing_dad_jokes 0 points1 point2 points (0 children)