Hacker News new | ask | show | jobs
by zomglings 2233 days ago
When is it better to solve those problems through the organization of your code rather than an autocomplete feature?

The things you mentioned all seem to yield to the decorator pattern.

Creating the right abstraction (instead of using autocomplete) would benefit future collaborators who may not have access to the same autocomplete functionality.

2 comments

The GP wanted to repeat some code modification 2-6 times. At that scale, adding abstractions often just adds unnecessary indirection and makes the code harder to read.
Depends on how often they intend to make changes to that code. But in general I think you are right.
Even if that was true, which I'm not arguing one way or the other, it wouldn't take much effort of imagination to come up with other use cases that aren't solved by decorators.

This has a taste of the old "they would have asked for a faster horse" argument.

I actually agree with you. I wasn't implying that the OP should consider refactoring their code. Just trying to understand for myself when I would prefer autocomplete over organization of code.