Lets talk about semicolons and practicing musical instruments for a sec. Trust me, it’ll all make sense at the end.
I used to hate semicolons
My first intense programming class was with Pascal. You know (or maybe you don’t), the sorta programming class where you learn about interpreters, compilers, bubble sorts, etc. It’s grueling, but certainly gave me a great appreciation for the art of coding.
The code we wrote was long. Now, with higher-level web based languages, you can just use a quick PHP function to do something like a sort or search. In Pascal, a bubble sort was a bit longer. Each procedure (search, sort, etc) was explicitly written, and some programs grew to hundreds of lines of code. The problem, was that debugging information was sometimes cryptic, and often didn’t include easy-to-follow directions to fix the issue.
That’s where semicolons come in. I used to forgot them all the time (they’re used to punctuate most lines in Pascal, just as they are in PHP). Every time I missed one, I would have to print out the code, look at each line, and attempt to find where the errors were. It was almost always a semicolon. I spent most of my time debugging code, not writing it.
[Perfect] practice makes perfect
Most of us have probably heard the phrase, “practice makes perfect”. Since I played multiple instruments throughout my childhood, I heard that statement more than I liked. It usually came out of a teacher’s mouth when I hadn’t put in the time to get my piece right for our weekly lesson.
Then along came a teacher, who said something impactful. They added the word, “perfect”, to the phrase. I wouldn’t come to understand exactly why that was such an important addition to the phrase until years later. What the teacher really meant, was…
A skill is a group of habits
A skill is simply the ability to do something well. And, each skill can have many parts. For instance, if you’re skilled at baking cookies, reading a recipe, buying ingredients, preparing them, and baking the cookies are all components of the skill. Some people are awesome at baking cookies, and some people aren’t. In-fact, there are people that can bake cookies without measuring, or are able to modify a recipe so that it keeps getting better and better. How skilled you are at something is directly related to how perfectly you’ve mastered each component of the skill, or simply, how perfectly you’ve created each habit.
Habit stacking = transcendence from mastery to extraordinary
Lets consider the idea of baking cookies again. The first time I ever baked a cookie, I had to look at a recipe. But, do you think a master baker has to do that? No way (ever watched cake wars?). They put things together, intelligently guess proportions, and are typically right on.
If you make cookies all the time, you instinctively know that you’ll need butter, flour, sugar, eggs, vanilla, and salt to make it happen. It’s so second nature, that in the back of your mind, you always know what the current level of these ingredients is in your pantry / refrigerator. If you happen to be at the store, you’ll probably pick up more flour, not because you need it for a particular purpose, but because you just know you need it. In other words, it’s a habit. When you see the cue (flour almost gone), it triggers a response in the back of your mind that says ‘buy more flour, buy more flour’. Then, you buy more flour.
I’ll spare you the breakdown of each habit in cookie making, but each item within the cookie baking process (viewing the recipe, buying ingredients, mixing ingredients, baking the cookies, cooling the cookies, etc) that you can turn into a habit, gives you more mental energy to experiment with new recipes. That’s where an extraordinary baker differs from a master baker. And this works with anything, longboarding, knitting, dancing, painting, programming, being healthier, whatever.
The science behind habit stacking
Habit stacking is the process of systematically creating and mastering habits one by one to build a particular skill (like baking cookies). The reason habit stacking works, is because you’re offloading repetitive tasks — like putting ingredients together, making a stitch, or painting the perfect stroke — from your pre-frontal cortex to your basal ganglia (gasp, science?!).
You might remember from biology classes, that the pre-frontal cortex is implicated in higher thought and decision making (among other things). When you’re first learning a task, the pre-frontal cortex is heavily involved. That makes it difficult to think of other things while performing the task (like, “I bet this cookie recipe would taste awesome with vanilla infused whiskey”). Once you’ve successfully created a habit, the processing of that task is handled by the basal ganglia and your ‘creative mind’ is freed to think about creative stuff.
The first time you got on a bike, roller-skate, longboard, or baked cookies, it was probably difficult. If you’ve done it a lot, it’s probably second nature.
How habit stacking made me a better developer
My semicolon hating days are over. In-fact, whenever I write a piece of code, I don’t think about writing a semicolon — it just happens — kinda like when writing a sentence with a period. When I write a logic statement, or a reserved function name, or anything else that I’ve automated by habit, I don’t think about the variables to pass or logical operators. I just write the statement instinctively. I’m able to do that because I’ve practiced (and stacked) habits of writing logic statements, correct punctuation and in-code documentation for years.
I’ve built perfect habit on top of some not-so-perfect habits (hey sometimes it’s hard to take your own advice), and now when I write code, my mind is freed up to think about creative approaches to problems rather than syntax. It’s a continuous process, one that started with the simple task of just getting started.
So here’s my advice
Decide what you love to do, start doing it, and build your first habit. Then, once you’ve mastered that thing to the point that you don’t think about it anymore, go onto the next habit. Keep doing this day after day, and you’ll be a master on your way to extraordinary things before you know it. But, only invest time in things that you really, truly love. Because lets face it, building habits and skills takes time. You better love whatever you’re spending that much time doing.
So, remember that phrase that a teacher told me back in the day… “perfect practice makes perfect”? Well I have a new one. Here it is:
Now, go forth and be extraordinary. And, if you’re feeling philanthropic, drop a note in the comments section and tell me what you thought of this article.