Monday, January 16, 2012

Bairui's School of Vim-fu

Wanna skill up in something?

How do you do it? What's your strategy? Do you have one?

One approach I'd like to put more thought into is Project Based Learning. I'll talk more about this in a later article. Here, I want to talk about Deliberate Practice.

You have probably already heard a lot about Deliberate Practice.

If not, just quickly: Deliberate Practice is the process of setting aside some time on a regular basis for the express purpose of challenging yourself at a level slightly above your current abilities in order to improve your skills in that area.

Stay Thy Sword!

I can picture your face now. It's an image of fading hope and growing disappointment. You thought this might be it! The silver bullet of learning and thinking. The answer to all your grokking needs. Well, maybe I can still be of some service...

Bairui's School of Vim-fu

Here is the method I used to go from a Vim dweeb to a power Vimmer in just a few months. The secret lies in an accidental application of Deliberate Practice. It turns out, years later, when I read about this Deliberate Practice stuff... that's what I was doing and I didn't know it! And you know what... it wasn't boring at all. It was fun!

Here's how I did it, addressing each of the requirements for Deliberate Practice:

  1. Mentally demanding, requiring concentration - I do this in the early hours of the morning, before the house pixies are awake.
  2. Challenging tasks - I find these challenges on the freenode IRC channel, #vim. I scroll back through the logs looking for an interesting, non-trival problem that I think is at the edge of my skills. If it's too easy, I skip it - other Vimmers need to grow too. If it looks too hard, I skip it, or write the gist down in a future challenges list.
  3. CANI - Constant and Never-ending Improvement - I put in regular time behind the keyboard every day to sharpen my Vim skills.  Can I keep it up for another decade...? I hope so! :-)
  4. Regular practice - I do it every morning with my first cups of coffee. On holidays... even longer.
  5. Feedback - you need to know if you're still on the path. Personally, I think this is essential and #vim again has the goods. There are people there who actually know what they're doing, and I compare my answer to theirs when I'm done. If I'm confused over a point, I can always ask on the channel to get clarification. It's a freaking Vim Open University!
  6. Have goals - honestly... I didn't, apart from the general desire to improve my Vim-fu. This is an area I could still work on. There are many facets to Vim and now that I think about it, the whole syntax highlighting thing still gives me the willies. If I were a goal-setting man, creating my own colorscheme would have to be on the list.
  7. In-practice self-observation and reflection - always. I'll write a map or macro or some VimL code and look at it and think, yuck!  Sometimes I can refactor it; sometimes I delete it and start again.
  8. After practice reflection when doing Real World stuff - Initially I wasn't conscious of this. Sometimes I would catch myself at a bad habit or not having learned from a recent DP session. In those situations I would, time permitting, undo my poorly implemented solution and redo it again the new way. I try to be more conscious of this these days. I think this is something that naturally grows when you start to pay attention to it.

There. That's the secret to my Continual Vimprovement. I hope it works for you too...

What?! It's still not fun enough?! Hard to please...

Ok... so, I might have a lower threshold for fun than you guys... So, can we make this funnier?

Can You Spare Twenty, Sir?

Gladwell (building on Ericsson) postulates 10,000 hours need to be spent on a craft before mastering it. This relates pretty well with the hours required of a Journeyman. These hours need to be put in over an extended period (they say ten years) for it to return the promised dividends (and Ericsson advises no more than four hours per day of Deliberate (arduous) Practice to avoid burnout.) Of course, you can't sit on the sofa for ten thousand hours and claim to be a zen master; the quality of those hours are far more important than the actual quantity. My Taekwondo instructor's way of saying this was: "practice doesn't make perfect; perfect practice makes perfect."

It happens a lot that when someone in #vim says: "I've been using Vim for twenty years!", they've really been using for nineteen years the same Vim they learned in the first year. This was certainly (and sadly) true of myself; I most certainly didn't spend the vast majority of my twenty (plus!) years with Vim "properly learning" it. It wasn't until around 2010 that I decided to really learn Vim. And it didn't take long, using the techniques above, to get adequately competent at Vim. A few months, really. LearnVim was a happy product of that journey.

Adequately competent? Yes. How good a vimmer do you need to be? My opinion: Good enough to not suck, for whatever value of 'suck' is appropriate to your circumstances. If you don't really need mastery, then you need a lot less hours. How many? Between twenty to fifty hours seems to be the accepted answer. :-o , I know, right?. Twenty to Fifty hours?! That's not so bad... At twenty minutes per day, that's 2 to 5 months. And I believe that with the right approach, twenty minutes of Deliberate Practice per day for two to five months will greatly enhance your Vim skills; or get you to adequate competency if you're just starting out. Would 40 minutes per day reduce your goal time to 4 to 6 weeks? Quite possibly. "Would 80 minutes per day make me a Vimmer after just two weeks?!" I think there's a point where actual number of days count as much as actual number of minutes, but let me know if you prove me wrong.

Currently, I would spend at least twenty minutes every day (as often as I can) in and around various aspects of Vim (outside of any actual coding work I need to do) of pure Deliberate Practice time. I still follow the School Of Vim-Fu as outlined above, hacking together little solutions for interesting puzzles on #vim.

And puzzle is the right word for it, too. I've recently come to consider Vim to be my Suduko. I borrow this notion from Chuck Moore who says the same is true for him of his beloved forth.

Suspecting that I know my audience, I'd wager that a good number of us spend at least 20 minutes a day playing games. Imagine our geniusness if we were to invest that in learning instead?! Even if you are acceptably good at Vim right now, I bet you could afford to spend twenty minutes per day pushing yourself in any number of areas where your vim-fu is currently weak. Just because you don't want to be a master is no excuse for coasting the OK Plateau.

I know, though, right? Learning is boring. It's hard. Nobody has done all the heavy lifting for us, as game designers do.

Game Face

So... let's change it up. What if learning Vim were more like playing a game? What if we had a place where we could meet and compare shiny new creations (like maps, functions, macros, colorschemes, entire plugins, whatever) every day. The system required you to generate something every day. You earned participation points for this. Then we could have daily challenges too. Everyone could participate in the challenge and submit their solutions. Each solution is automatically checked to verify correctness, but also gets peer reviewed by several random 'players' (vimmers) on more of an aesthetic evaluation - is it a pleasant solution or does it make your cat howl? Vimmers are rewarded for doing these reviews. Earn enough points and you climb in rank - giving you access to more power in the system, including being responsible for providing a Daily Challenge pack (challenge + tests).  Did you see that? That's the heavy lifting missing from traditional self-paced learning - provided for us by our team of elite Vim masters - a rank you can strive for by showing us your goods.

Obviously, in my limited way, I am trying to describe a Gamified Vim learning environment. We can add badges and leaderboards but we'd better have something real to keep our Vimmers attracted and engaged too. What? I dunno. Suggestions?

I would so love someone to build this. I'd even be interested in lending a hand. Come... let's play.