Frank Allan Harrison
Muscle memory for code
In martial arts you are better off practising a move until it becomes one without thought, "when technique comes out of itself, that is the way" to quote Bruce. You become efficient in your moves and it frees up your mind to concentrate on a higher order of strategy, it frees you up to "flow".
Experienced sports-people know what it feels like, on rare occasions, to be able to dominate an opponent, be so much better than they are; when you are in flow, you move faster than they can, you can read their movements, and you can completely control the situation, on the mats, on the courts, or in the ring. Just look at how dominant Serena is or Federer has been.
You can apply the same to coding.
"All technique is to be forgotten and the unconscious to be left alone to handle the situation. Technique will assert its wonders automatically or spontaneously. To float in totality, to have no technique, is to have all technique." - Bruce Lee, Tao of Jeet Kune Do
The idea is to practise the things that you "should do" to such a degree they become second nature and thus you free up your mind to focus on the more difficult architectural aspects of your code whilst making your code much more maintainable and efficient.
“I fear not the man who has practiced 10,000 kicks once; I fear the man who has practiced one kick 10,000 times.” - Bruce Lee, Tao of Jeet Kune Do
The things that should be second nature are the things that can kill a project later on because no consideration was given to them at an earlier stage.
- branch prediction
- copying
- data access
- locking
- thread safety
- modularity
- function size
- class spilt
- readability
- self documenting
- ...
Now some of these things are not easy things but if you build up a good awareness of how day-to-day code affects them the you may save hours of time later on...
... and often those hours you save will be during crunch.