Brendan Enrick

Daily Software Development

Programming is Not Just Typing

One of my favorite quotes about programming languages comes from Ward Cunningham who said, “If you don't think carefully, you might think that programming is just typing statements in a programming language.” Not sure if he really said it, but it is attributed to him plenty of times on the Internet.

So back to Ward Cunningham for a minute. I really like that quote. It says one very powerful thing about programming that I think is known by a lot of people using programming languages, but I am not always sure they think about it in this manner. I know that non-programmers certainly don’t understand it. Plenty of people think that all we do all day is type, but there’s a heck of a lot more to it than that.

Nearly a year ago, when Jeff Atwood posted about our being Typists First and Programmers Second, I was quite appalled. Here is one of the most respected individuals in our industry, and he’s making a statement like this in a blog post. Sure I agree that one of the core skills that every programmer needs is the ability to type. I don’t disagree with the importance of typing. I think a programmers ability to quite quickly and accurately is extremely important. He says in the post that there are other things of importance, but I refuse to say that our primary skill is typing.

Although I find that programmers should spend some time thinking and some time typing. If you’re typing non-stop as fast as you can then you’re probably not thinking enough about what you’re typing.

Like broken clocks, even pointy-haired managers are right once a day. Coding is just typing.

This is a bit crazy to me since I work on code every day. I can certainly say that coding is not just typing. This is one of the reasons why I am an advocate of pair programming. I think that a fair amount of time needs to be spent thinking. All programmers need to be able to type quickly, but the core of what we do is the thought and design that goes into making an application that we can be proud.

Don’t get me wrong I have the highest respect for Jeff Atwood. I think he is one of the greats. I just disagree with the priorities here. I believe that a developer can certainly benefit from typing faster. In fact I wish I did type faster. I certainly don’t hunt and peck. I’ve typed without looking at the keys since I was a kid. I can touch-type the “correct” way, but I have my own style that has worked for me since i was a kid.

Most of the development I do these days is pair programming. An Extreme Programming technique I am sure most of you have at least heard of. This technique is an excellent one that I believe produces better software. Why? Well for one because it lets developers spend more time thinking and less time typing. Both guys are thinking, but about different things. One developer has the keyboard at any given time and keeps in his head the path he is on. (This guy is concerned with typing speed.) He types along the path thinking about the code he is currently writing not the structure of the app, but the code he is typing right now. For a short time his typing speed matters.

The programmer in the pair who is not actively typing is spending all of his time thinking. He keeps in his head the path that the typist is taking, not concerned with the syntax of the programming language. That is the other guy thinking about the language syntax. The one sitting back without the keyboard is the guide. He must make sure that the pair stays on the right path using the most efficient route to success.

By spending time thinking the pair is able to take the smarter path to their goal. Rather than brute-force typing speed we use intelligence of our development team to ensure successful work. This isn’t to say that we shouldn’t type very very fast, because typing fast sure does help us be better developers. However, more important than our typing speed is our thinking speed.

If you’re considering your typing speed to be more important than your thinking speed then I am concerned to see how you’ve structured your code in such a way that you need to type very fast. I find that well structured code requires a lot less typing and a lot more thinking.

If you pause and consider for a minute who are the most revered of developers in the world. Do they type fast? I bet most of them do. Is that why we revere them? No probably not. The greatest of people who code are some of the greatest minds in our industry. They are not the greatest typists in our industry. If you could type 200 WPM do you really think your code would be that much better? I doubt a developer could get more than a 10 or 15 percent increase in efficiency even typing that fast. But if you could think twice as fast I am sure you would see a much larger increase in how efficiently you wrote code.

Good luck with either endeavor, but don’t tell me I’m a typist. I am a thinker first and a typist second, and I refuse to let anyone tell me otherwise. Just because someone can type and knows a programming language does not mean that they can create software of any value.

Productive Typing

In software development it is very important that you type quickly. Now some people are going to be thinking that simple words/minute is important. I agree that it is important to be able to type quickly in general while programming. There are other aspects to this as well. Now consider if you have two programmers and one types twice as fast as the other. Which one is more valuable to the company? So I might have oversimplified this, but I would assume most people who go and read blogs are probably trying to improve their skills as a developer and if you're not considering your programming (typing) speed then you're not considering enough.

As a said moments ago, I am not going to talk words per minute. That isn't always relevant since we're not always typing words. Ours are a lot of the same words as well as a lot of symbols. It isn't normal typing. What I am going to say is that developers need to be taking advantage of keyboard shortcuts and snippets; from the standard ones which work in many applications down to Visual Studio specific shortcuts. A lot of developers use add-ins like CodeRush and Resharper to increase their development speed.

Program Agnostic Shortcuts

Starting simply, I will talk about one of the simplest tricks which will help you everywhere. Use your Home and End keys religiously. They will help you tremendously getting you to different points on a line very quickly. This is a simple one that everyone can remember. The extra trick to know here is that you can hold the Ctrl key and it will jump you to the top or bottom of the page.

So I've just mentioned the Ctrl key I will say that it is the most useful key for shortcutting. I'll now go on a rant of the non-VS specific tricks in can help you with.

Everyone should know copy (Ctrl + c), cut (Ctrl + x), and paste (Ctrl + v) There are plenty of other ones dealing with that key that are also very simple. I can't spend the time talking about all of those. Some of the lesser known ones are also important. For example. Everyone knows that you can use the arrow keys to move the cursor right, left, up, and down. If you combine the left-right movement with Ctrl you will notice that the cursor jumps "words". What consists of a word is interpreted differently depending on the application, but try it out in them and you'll see how useful it is. It will save you a lot of time.

Combine this with the shift key for Ctrl +  Shift + [Direction] and you'll be able to select these words very quickly. This is useful for replacing and changing test or simple copying a variable name. Whatever you've got to do. When you're deleting, don't waste time with it. Combing Delete and Backspace with Ctrl will let you delete "words" very quickly.

Visual Studio Specific Shortcuts

I certainly can't cover all of the shortcuts here, but there are a lot of them. For example if you need to make an auto-property all you need to do is be in the context of a class and type "prop" and then hit Tab. You will get a snippet for your property. If you need a for loop you better not waste time writing it. Most for loops are the same, so just type "for" and hit tab. These are all of your snippets and you can customize and create your own. This is easy and there are tools for editing snippets.

You should also look into the different refactorings that Visual Studio is able to do. Right click and choose Refactor from the context menu and you will see a bunch of options available to you.

Also the most powerful shortcut specific to Visual Studio is Ctrl + . which is context sensitive. For example if you change a name pressing that afterward will allow you to do a rename. There are a lot of other context specific options such as including using statements at the top of the file after adding an type which requires one.

Other Tools

If you're really looking to speed up you should look at some of the third party add-ins to visual studio. Resharper and CodeRush are a couple of the popular commercial products. I currently use Resharper, but I've also lost a coding competition to someone using CodeRush. They're great and integrate a lot of what you need. These tools also come with keyboard mapping files which you can print and have a reference of the shortcuts to speed the learning process.

Resharper for example has a lot of shortcuts for navigating. Ctrl + n lets you search for different types and jump directly to them. Ctrl + Shift +  n lets you jump to files. The searching is fairly smart. The tool also adjusts your intellisense so that it pays attention to campital letters. For example if I were going to type "SuperSpecialStaticClass" I could type "SSSC" and that would be the top of my intellisense. If there were a class named "SlightlySpecialStaticClass" I might have to type "SuSSC" or just go down to the next choice in intellisense.

Rather than spend much more time talking about third party tools I will just say that there are a lot of them out there. They're not very expensive and they will make your time spent be more productive.

Make sure you stay up to date on all of the tools and shortcuts available to you.