Muscle Memory vs Muscle Tone (in programming)
This week at work I ran into a situation where I had to parse a large, complicated json file. Let me paint a picture for you.
I work at a decent sized company and my team works on a service that sits in the middle of a pretty large stack of dependencies. There are plenty of services before us, and after us. Because we have to integrate with those services our build system and deployments are involved — they have to handle authentication, pulling down dependencies, integration tests, scaling, roll back, etc, etc, etc.
We happen to write our service in Java (Ah Java, “Did my hear love ’till now?”) so it can be time consuming to add a small script to it (you have to create the package, add the class, get all of your typing right, integrate it with your dependencies, etc, etc, etc.
Because of all of that I often run into a situation where I think to myself, “It would be really handy to extract a small amount of information from this json file, but I don’t want to take the time to build a java program to do it.” Which is often when I turn to a scripting language like powershell or python.
I worked in python a lot for a few years, but I switched jobs a while back and haven’t had a need to use it so I’m about 6 months rusty on python. And let me tell you, the syntax was an adventure for a while. If you haven’t done much python let me vent
- Why is whitespace a delimiter? That’s stupid. Whitespace is invisible, your language shouldn’t care
- What’s with the arbitrary english words?
value in <set>
,for value in values
. Come on. - List comprehensions are excessively confusing. My issue is with having so many variables with so few operators. How are you supposed to remember what’s supposed to go where?
- Why is python 2.7 still default in so many places? I get it, I can change my
path
variable to use python 3.whatever, but shouldn’t someone else be figuring that out for me, or making it easier? - Shouldn’t there be more parens?
And my struggles brought back an quote I heard from a professor a long time ago
Some programming is muscle memory, some is muscle tone.
Some parts of programming will always stick with you and will come back to you in a heart beat (almost) no matter how long it’s been since you’ve done them. These are the things that are axiomatic to programming, the things that are foundational. Things like
- Control statements (loops, if statements, etc)
- Object Oriented Programming (i.e. “should this be in a separate method?”)
- Concepts about memory management and performance
- Run time
Then some things are muscle tone and tend to fade from memory the longer you go without using them. These are the nitpicky things that can take the most energy to get back into (like python syntax). These are things like
- Specific syntax for a language (i.e. “do I need a semicolon here?”)
- Specific libraries common in a language like sorting, collections, web requests
- Specific functions on some of those libraries like
size
vslength
Another way to say this is that any competent developer can tell you that in any language you’re using an Array will be able to tell you it’s length, but they may not be able to tell you if it’s len()
, size()
, or length()
.
I feel it’s important to articulate because it’s the programming muscle tone that’s often the most visible. When you’re pair programming, or trying to fix a bug and you have to pause to google “How can I tell if python hash map contains a key?”, and then it takes you a few minutes to remember that python calls them dictionaries (and that should’ve been on my list) you feel a little dumb.
But those are also the things that are the easiest to find answers to on the internet. People on stack overflow are happy to remind you how to find the length of a collection in python, and those answers are readily available. It’s muscle memory that takes far, far longer to develop.
No one on the internet can (easily) tell you whether or not your method is too long and needs to be broken up. And if you need to google, “what’s a for loop do?” every time you’re getting started you’re going to have a really, really rough time building your program.
I’ve seen a lot of new programmers make progress on syntax (muscle tone) and then feel like they’re making very slow progress on muscle memory (concepts). I hear things like, “I’m still working on understanding loops, I’ll let you know when I’m making real progress.” or, “I’m really struggling with why you would break code out into a function, I feel really slow.”
It takes longer to build muscle memory than muscle tone. Don’t get discouraged, it’s well worth taking your time to build the muscle memory!