Tuesday, October 8, 2013

Embracing The Beast: Where Do We Start?

The Beast, as explained in the first post, is Visual Studio, and my objective is to finally really master it once and for all.  What's the criteria for "master"?  It's not a simple question because VS has so many different parts and features...  Does mastering it mean you know when and how to use every single one of those features?  Does mastering it mean you use it as fast and efficiently as possible?  Where's a poor vim-loving-wanna-be-hippie-alt-dot-net-developer to start?

There's two main related places I believe make the most sense to start, and that I believe will help drive out learning what other bells and whistles and sirens and synthesizers VS has to offer:
  1. Let go of the mouse
  2. Touch fewer keys
That's it.  Just those two things should give us a really solid start at becoming much faster and more efficient when coding in VS.

I'm guessing I don't really have to convince most of the people reading this that this is correct.  But, you know, it's low hanging fruit, so I'm going for it anyway...  Maybe you like the mouse.  Maybe you read that one ancient article from the early Mac days that says using the mouse is actually more efficient than the keyboard.  OK.  Tell me, how often do you save the file you are editing by:
  1. Grabing the mouse
  2. Dragging waaaaaaaaaaaaaaaaaaaaaaay over (monitors are BIG these days) to the File menu, clicking it
  3. Dragging down to the save item, clicking it
Or do you just hit Ctrl+S like 100,000 times subconsciously every time you stop to think about what to do next?

I thought so.

That's the thing about keyboard shortcuts, once you have practiced them to the point where they are engrained in your muscle memory, they are fast and require no thought and no time lag, allowing you to forget the physical steps of editing and focus on the more abstract ideas of what you are editing.  But lets not skim over the most important part of that last sentence: practice!  Real practice.  The kind of practice familiar to most people who have played a musical instrument of some kind, which mainly consists of repetition, repetition, repeating yourself, doing it again, and again, repetition, slow repetition, fast repetition, and then more repetition.  And if you didn't study music but instead spent your time going to sporting rehearsals (is that what they're called?), you probably experienced much the same thing.

So, if we are going to let go of the mouse, and touch fewer keys, we're going to have to practice shortcut keys.  For me that practice usually looks like:
  1. Learning a new shortcut key
  2. Writing it down
  3. Trying it out a few times
  4. Purposefully finding opportunities to use it
  5. Paying close attention to my coding and if I miss a chance to use it,
  6. leaning on undo
  7. doing it again with the shortcut
Repeat, repeat, repeat, repeat, repeat.  It's also important not to stretch yourself too thin all at once.  Focus on a couple things at a time, work 'em to death, then do some other things, then go back to the first things again, etc.  Some of this is going to be extra-curricular.  Some of it can happen on the job.  Some of it will slow you down a bit.  It's OK, you're going to be happier for it soon.  And it's not going to take as long as it feels like it does.  I have no studies to prove this, I believe it on blind faith alone, and encourage you to take my word for it.  We're software developers after all and that's how we do this.

OK, cool.  So we need some shortcut keys to learn.

The Basics
These are the essentials, chances are anyone who's used VS for any amount of time knows these already, so let's get them out of the way.

ShortcutAction
F6 or Ctrl+Shift+B Build
Ctrl+F4 Close Window
Ctrl+, Navigate to
F5 Run
F9 Toggle Breakpoint
F10 Debugger Step Over
F11 Debugger Step Into
Ctrl+R, T Run Tests
These you already know cut, copy, paste, undo, redo, save

Slightly Better Than Basic
Moving a tiny bit up the scale toward shortcuts that are still bread and butter, but might be slightly less well known.

ShortcutAction
Shift+F5 Stop Debugging
Ctrl+E, C Comment Selection
Ctrl+E, U Uncomment Selection
Ctrl+M, M Toggle Outlining
Ctrl+M, L Toggle All Outlining
Ctrl+G Go to Line
Shift+F6 Build Current Project Only

Learning shortcut keys isn't all there is to mastering an editor, but it's a big part, and it's certainly the first step.  With these basics out of the way, we can move on to more interesting stuff.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.