3 ms·
> I generally think that if I can't find a good name for a thing, I don't actually know what it does yet, so Im not ready to code it. I can understand that vie
by hansvm 6y ago
> I generally think that if I can't find a good name for a thing, I don't actually know what it does yet, so Im not ready to code it.
I can understand that viewpoint. On the other hand, you have to develop that understanding somewhere, and on some problems I find that sketching out a solution in code is more productive than using a whiteboard or some other mechanism, especially if I already have a rough idea of what needs to happen.
E.g., I might know that I need to keep around a little intermediate state, and I'll throw that in an unremarkably named variable and iteratively build up the rest of the algorithm. Once I have _some_ solution I can go back and see if the variable was really important, prove it correct (or find additional work to do), and dole out meaningful names.
The idea isn't that different from how when building up something which needs a loop you might start with "while (True) {}", figure out where you need to break, and then go back and factor in an appropriate stopping condition once you understand exactly what the loop needs to do to accomplish your goals.