This is one of the most interesting artifacts of programming, and it's probably impossible to explain to people outside the field. How at the same time it's trivial and important, and a constant cause of neuroticism. It takes up far too much tought-space to the point I would gladly follow some ugly set of conventions merely to have to just never think about it.
How Developers Choose Names
41–50 of 157 posts
Re: How Developers Choose Names
#42Earlier quoted context omitted.
I’m an engineering lead and I made a rule of using the handleClick() style instead of updateDate() in our codebase. The reasoning is that the latter sounds more like an atomic, standalone function, whereas handleClick() may have some internal checks that could eventually call something like updateDate(), but the internal checks are beyond the responsibility of the updateDate() function.
Yes my example was if updateDate literally just updates the date - I take this a step further too, Eg if the function has some extra checks, I’ll name it maybeDoX(), which is a somewhat uncommon practice in common programming languages
Re: How Developers Choose Names
#43I have a rule called “name it what it does, not how it’s used” which is a mistake I often see with junior developers and sacrifices information density Eg it’s more helpful for readability to do “onClick => updateDate()” rather than “onClick => handleClick()” (Not the best example and I’ve seen far more egregious, but those examples are escaping me now)
I’m an engineering lead and I made a rule of using the handleClick() style instead of updateDate() in our codebase. The reasoning is that the latter sounds more like an atomic, standalone function, whereas handleClick() may have some internal checks that could eventually call something like updateDate(), but the internal checks are beyond the responsibility of the updateDate() function.
Re: How Developers Choose Names
#44I have a rule called “name it what it does, not how it’s used” which is a mistake I often see with junior developers and sacrifices information density Eg it’s more helpful for readability to do “onClick => updateDate()” rather than “onClick => handleClick()” (Not the best example and I’ve seen far more egregious, but those examples are escaping me now)
I’m an engineering lead and I made a rule of using the handleClick() style instead of updateDate() in our codebase. The reasoning is that the latter sounds more like an atomic, standalone function, whereas handleClick() may have some internal checks that could eventually call something like updateDate(), but the internal checks are beyond the responsibility of the updateDate() function.
Re: How Developers Choose Names
#45Earlier quoted context omitted.
If you don't have refactoring that can rename functions across your code base, now you have two problems
In 16 years as a developer, I have never seen this beyond the scope of a single project/language. Once things cross boundaries it stops.
Re: How Developers Choose Names
#46Re: How Developers Choose Names
#47Re: How Developers Choose Names
#48Naming things - one of the four hardest problems in computing (the others are sorting and off-by-one errors) :)
Sorting actually isn't one, at least anymore. Exact once and in-order delivery although part of 'distributed' computing should be, since most computing is distributed, right down to our multicore processing hardware.
Re: How Developers Choose Names
#49One of the most cruel things evolution did to us is that we constantly seek meaning, order, correctness, where there are none to speak of.
Re: How Developers Choose Names
#50(1) How would I explain face-to-face what this code does to another developer?
(2) Use the key words from that explanation to make a name as short as possible without losing clarity.
Example:
Step 1: This class handles all the navigation work for the sign-up flow in our mobile app.
Step 2: SignUpFlowNavigator