Hacker News new | ask | show | jobs
by piaste 1621 days ago
I use, and teach juniors basically the same rule as your first one.

I phrase it a little differently though: "if something happened in the future that required a change to function A, would the same requirement apply to function B as well?"

I think your second heuristic is valid but a little dangerous, because being good at naming functions is somewhat orthogonal to being good at maintaining code.

1 comments

From my perspective, naming functions well is a key component of maintainable code.

However, in this case, I use it is an extension of the question "is this the same concept?" if it looks like useFloorWaxOrDessertTopping, it's a good clue that you may have the same lines of code but they are certainly not the same concept.