News for hackers. Stuff that matters.
Re:How Developers Choose Names by rileymat2 on Sunday April 18, 2021 @10:31AM (#26852792)
I’d agree in some cases, but then you get weird debouncing code in your update date function. Because, no one wanted to change the onClick function name in 38 different places when it starts to do more.
Re:How Developers Choose Names by hallway_monitor on Sunday April 18, 2021 @10:37AM (#26852852)
If you don't have refactoring that can rename functions across your code base, now you have two problems
Re:How Developers Choose Names by rileymat2 on Sunday April 18, 2021 @10:44AM (#26852932)
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 by echelon on Sunday April 18, 2021 @11:30AM (#26853321)
I've hit this many times.

Microservices and JSON APIs.

Common library code (eg. common session handling) incorporated into dozens of microservices.

Monorepos (which actually make this problem somewhat easier).

Re:How Developers Choose Names by dividedbyzero on Sunday April 18, 2021 @10:52AM (#26852993)
Even within those bounds, I found it doesn't always work terribly well (depending on the language, tooling and project complexity)
Re:How Developers Choose Names by marshmellman on Sunday April 18, 2021 @03:59PM (#26855781)
What boundary would be involved in the handleClick example? Or are you speaking more generally about renames across API contracts?
Re:How Developers Choose Names by rileymat2 on Sunday April 18, 2021 @06:43PM (#26857216)
Here is a great example that came up last week. Almost exactly like the OP. (It is even an onclick!)

I have a C# .net MVC web project. All of the JS, .cshtml templates and C# controllers are in the same visual studio solution. So it has complete vision into the code.

So the boundary is from cshtml template to javascript function and then another one from the js function (ajax call) to C# controller.

Visual studio has complete vision, but loses the connection at each boundary, so intellisense says that the C# controller function is never called.

I am not criticizing Visual Studio, it is a great tool, but this is a hard problem.

Re:How Developers Choose Names by Forge36 on Sunday April 18, 2021 @10:40AM (#26852879)
onClick => onAccept => submitRequest

The downside is lots of little functions, the plus side is smaller behaviors. (Ie avoiding 5 levels of nesting in a single function.)

Re:How Developers Choose Names by MattRix on Sunday April 18, 2021 @12:13PM (#26853698)
This sort of thinking leads to codebases that are too abstract, where it’s hard to follow the flow of execution.

There’s nothing wrong with 5 levels of nesting. It’s much easier to follow than 5 separate functions.

Re:How Developers Choose Names by Forge36 on Sunday April 18, 2021 @09:20PM (#26858274)
Depends on the size of the function. If these are literal one liners: don't break them up. When they are shared between multiple pieces it's more useful. Ie: submit request has multiple callers.