Many programmers complain about speed when coding. For some it is a matter of typing speed for others it can be hardware or software issue and some need a better understanding of the tools they have at their disposal.
The Absolute Basics
Starting with the absolute basics we look at simple ways to improve speed that may not seem obvious. However, many programmers will benefit in coding speed and quality with these simple improvements
- Touch Typing
- Coding Environment
If you don't already learn how to touch type. Speed will greatly increase when not looking at the keyboard for which letter to type.
On the topic of keyboards, if your keyboard is problematic replace it. The investment in a nice keyboard is more than worth the expense. "Cheap" only saves money if you are really broke.
Without getting into the debate of which IDE or editor is best using a real code editor with intellisense, word completion, and refactoring tools removes a lot of frustration and time wasted.
One of the biggest reasons for slow coding is a machine that cannot keep up. Make sure that you have a machine that is actually fast enough. Pay attention to hard drive speed, memory, CPU, etc.
Reduce the Amount of Code
Use code completion tools and generate code with templates to cut down on the time wasted doing repetitive tasks. Convention always beets configuration. Use automated refactoring tools where possible for changes. Libraries are your friend so use them especially if someone else wrote and maintains them.
Cut Back On Errors
Plan your code before you sit down and begin typing it. Drill your typing skills for reduction of errors. Get up each day and run through a 5-10 minute drill. In line with the previous step using code completion, templates, and automated refactoring reduces errors.
Tips To Improve Your Actual Speed
- Learn The Shortcut Keys
- Reduce Usage of the Mouse
- Avoid Context Switching
- Stop To Think
- Code What You Know First
Your IDE or editor has shortcut keys designed to make coding faster. If you find you are repeatedly going to the menu for something learn it’s shortcut and practice using it. Post a “cheatsheet” of shortcut keys near your monitor so you can quickly glance at it. Included in the links are a couple of these one for Windows and the other for general OS functions that will work cross platform.
Try going a day without using your mouse. Not leaving the keyboard will reduce a significant amount of time during the day. With OS and IDE shortcuts it’s possible to not use the mouse at all.
Multiple monitors is a great asset to any coder. Time spent switching screens can be completely avoided by having everything you need right in front of you.
When you realize that you are having to stop and think to get things done do so. Don’t mix the mechanics of writing with the process of design. Neither your writing nor your design will be best.
Start with code that you know you can get working first. Take care of the first order unknowns before tackling the second order or “unkown unknowns”. In addition this gives a dopamine boost by acomplishing a task just before starting the difficult work.
Bringing It All Together
Practice daily as mentioned above. First improve your typing speed and error rate. Then work on code katas. Finally this isn’t a test so keep cheatsheets around and use them as often as needed.