Skip to content

Programming in movies and in real life

Week ago I saw this vine: “Programming in movies vs. programming in real life”

Funny isn’t it ūüôā

It made me think about how fast do you actually need to type as a developer. Do you need to be a fast at all? It certainly helps, but is it a required? We are supposed to be thinkers and creators. Stephen Hawking cannot type at all, but somehow continued to publish for years!

Of course¬†I checked how fast can I actually type¬†first. There are plenty of sites on the internet for that. I¬†got 60-65 wpm. Not sure if this is good or bad, google¬†tells me this is “above average”. But what I was asked to do at those sites – type a series of sentences – was very different from what I really do when coding.

So I opened IDEA – my favorite Java IDE, created new project and started to code. Lets see the difference. Problem – Game Of Life, starting from an empty test class:

First Test
(Click on the image for a larger view)

My¬†IDE knew what I¬†wanted to write – so I¬†do not need to write all of it. It even suggested variable names, so all I¬†have to do is press Enter and it “typed” it for me.

Let’s continue:
First Test Implementation
(Click on the image for a larger view)

Pressing <Alt> + <Enter> in IDEA (<Ctrl> + 1 in Eclipse) on a missing class or method will suggest you to create it. Easier for you and much less error prone. What I like best from this technique however is not that it saves you typing time. Working like this makes it easier to focus on the big picture and not go into small details right away. Details that are much harder to get right, so you need to change them later. You will focus on what you need first, than work on the other details.

Let’s fast forward a bit – I decided I need a Set to hold my cells and a class Cell. So I needed hashCode() and equals() for my class. I used Generate for that – it can be chosen from Code menu, by right clicking in the class or by the shortcut <Ctrl> + N.

Using Generate
(Click on the image for a larger view)

Now how many wpm is that?

All of the above is just scratching the surface Рso far we have only generated code and done no refactoring. Our project is also very simple and everything is at the same place. This is important as navigation and refactoring are the two areas where any good IDE really shines.

We programmers do not just type code. We always need to think first. When I thought I needed a class I pressed a button and class was created for me. If I need to change a name of a variable РI can press a button and it will rename all variables with that name instead of me having to search and replace them. I could have just typed the class definition, but its a waste of time. Its not what I wanted Рits just one of the ways to get there. Writing code with a good tool is not like writing a letter, its like playing a game.

In real life a programmer is a thinker first and typist second. If you are serious about programming,  you definitely need to learn to produce good code fast. Fast typing will help for that, but there are plenty of good tools out there that will help even more, if you know how to use them.

Thank you for reading.