Cheat Sheets Vs Playbooks for Programmers
Investors to well renowned performers, surgeons have their playbooks, marketing and sales department have their playbooks. Programmers who cannot cheat the interpreter/ compilers have “Cheat Sheets”. It is an Irony, isn’t it???
Objective:
To persuade you to create your own Playbooks for the programming languages, Database systems and infrastructure you are learning
tl;dr: Please go the “My Playbook for Vim” section below
Background:
Programming, and the types of problem it can solve using the different levels of processing power, cost and importantly your knowledge and mastery. Cloud computing has opened up a huge “Worm Hole” in the cyberspace today.
You will find very soon that, the speed at which you can work with cloud infra depends on how fast is your internet, and how perfect you are predicting what the program or code does. The second part is the biggest competitive advantage you as a individual contributor can have.
Improve your skills to Express:
Programming and Processors may seem to have nothing to have in common with Water, and on top of it Bruce Lee. But it has lot in common.
The above video is one of the lost interviews of Bruce. He talks about expressing yourself honestly, truthfully. In order to express oneself with the programs, the processors and systems we build it takes a different types of practice. Not using cheat sheets…
Learning to Practice Vs Learning to Express:
Our education system is geared towards learning to practice what we learn. Only few among us realize that, we all have different ways of Learning to Express. To be like “Water” as Bruce says, it is possible only if you follow your own ideas and achieve the learning objective. You have to be your own teacher. Make your own practice drills that puts you in Flow. Work on them every day.
Don’t equate the way of practicing that we use for competitive programming. There we are practicing the set of puzzles through algorithms. Here the objective is to simply practicing to get into flow for a simple task, and then express it in our style.
My Playbook for Vim:
Vim has been made very approachable through the SpaceVim distribution. Thanks to Derek @ Distrotube, I got to know about new version of vim and started using it. In-fact began entering into flow when working with Vim. I was thinking how I could learn Vim so fast? The key is to become comfortable with as much commands as possible to solve the Text related Problems.
Here is the playbook that I practice weekly once, and time yourself. Try to do them as fast as possible inside the Vim Editor.
Do these 14 steps weekly once:
1) Split the working Vim window into multiple window by
splitting vertically / horizontally.
2) Insert the output of your any of the config files in
to the current document. Ensure you try out this insert in
different locations.
3) Replace a pattern or word like "the" / "am" that is occuring in the file
with a different pattern.
4) Do the above for a specific range of lines in the file.
5) Do the above for entire document, for the current line.
6) Execute the command on last line of the file, current line to last line
7) use the .,.+5 command and see what happens.
8) execute the line deletes with a particular pattern with global command
9) execute the line that deletes liness WITHOUT the patter
10) try putting a new line before everyline
11) now remove every empty line
12) copy the lines with particular pattern to end of the file
13) move them to end of file
14) reverse the file
Here is the important point. When you begin the Vim Practice, the above 14 steps will take lot more time. As the time progresses, your comfort with 14 steps will increase steadily.
What to do if I don’t remember the command?
Skip Them… Its fine. You are going to do it next week again.
The below commands are used for executing the above steps. You will have this available with you. After you have completed the exercise once, then you can review the step, that you were unable to execute.
1) :split , :vs
2) :num read !command or :read !command
3) :s/old/new/g, :num s/old/new/g
4) :11,15s/old/new/g
5) :. and :%
6) .,$write
7) Works on the current line + 5 lines, did it
8) :g/patern/d
9) g! or v
10) :g/^/pu =\"\n\"
11) :g/^\s*$/d
12) :g/import/t$ or /m$
13) :g/^/m0
Its not only for Vim:
I have been developing such playbooks for a range of
- Programming languages, like shell scripting, Python and
- Machine Learning libraries like Pyspark
- Massive systems like AWS automation through Boto3.
- Database creation in Postgres
The key is the speed with which you can complete these playbooks. I borrowed seed of this idea from “Robert Cecil of Clean Code”. He introduced me the concept of Kata (the analogy to martial arts comes from there). He discusses about creating these Katas for Programming Languages, Test Driven Programming. I tweaked it and applied to everything ranging from learning to touch type to mastering AWS cloud Architecture.
Thats all folks. Happy practicing and entering into flow.