Published on 21 May 2014.
I recently read a comment that said you should always name intermediate results in your program. Sounds reasonable.
However, what I sometimes do when writing code is to assign something to the name “foo”. This probably happens more often when I refactor. Sometimes I can easily see the new structure that I want. It often involves more intermediate steps than the structure I have. At that moment, I don’t want to think about what to name that intermediate step. I don’t event know if it will still exist a minute from now. I just want to see the new structure. It’s first when I’m happy with it that I think about what “foo” should really be called.
Is this workflow backwards? Or is it ok?
TDD changed the order in which we write tests. Writing them before the code now feels natural (to me at least). Is it the same with naming intermediate results? Do we gain something by thinking about the name first before seeing the new structure?
–
What is Rickard working on and thinking about right now?
Every month I write a newsletter about just that. You will get updates about my current projects and thoughts about programming, and also get a chance to hit reply and interact with me. Subscribe to it below.