4 ms·
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
by rileymat2 6y ago
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.
- hallway_monitor 6y agoIf you don't have refactoring that can rename functions across your code base, now you have two problems
- rileymat2 6y agoIn 16 years as a developer, I have never seen this beyond the scope of a single project/language. Once things cross boundaries it stops.
- dividedbyzero 6y agoEven within those bounds, I found it doesn't always work terribly well (depending on the language, tooling and project complexity)
- echelon 6y agoI'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).
- marshmellman 6y agoWhat boundary would be involved in the handleClick example? Or are you speaking more generally about renames across API contracts?
- deleted 6y ago[deleted]
- rileymat2 6y agoHere 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.
- Forge36 6y agoonClick => 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.)
- MattRix 6y agoThis 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.
- Forge36 6y agoDepends 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.