Most programmers are really bad at programming. Grab 10 random students from a computer science masters program and your correspondent will happily wager a case of Brooklyn Brewery Chocolate Stout that at least nine of those programmers will fail a basic programming task.
Guns Don’t Kill People, Bad Code Kills People
Why should anyone care if most programmers are bad? Well, what if the same were true of surgeons? Or commercial airline pilots? Sure, human life doesn’t depend directly on the daily work of a programmer. But the software they create sure does.
Think about all of the bad code in the control systems of nuclear power plants or in the computers under the hood of your car as you speed down the highway at 115 mph.
Are You Experienced?
Experience has little to do with programmer productivity or even in determining if you are a good programmer. But good programmers do have one trait in common: good programmers work very efficiently.
Why? Well, it mostly boils down to two things:
- They are really smart;
- They are really good at figuring things out.
When a smart person who is good at figuring things out asks him or herself how can I do this faster? productivity gains are realized.
Zen and the Art of Being a Productive Programmer
Whenever your correspondent teaches a web technology class — be it a course on project management or XML-based web services — there is always a class spent talking about how to work efficiently.
Beyond tips for basic productivity gains, here are some specific techniques for web programmers:
- Use ALT-TAB to move between your code and your browser;
- Use keyboard shortcuts;
- Use a good IDE;
- Isolate and toggle when debugging;
- Use small successful iterations; and,
- Use a good query editor.
ALT-TAB is straight forward enough. Don’t waste time moving your hand from the mouse to the keyboard. Sure, it only saves a second. But you are making this motion hundreds — perhaps thousands — of times per day. It adds up.
The same goes for keyboard shortcuts. Learn how to outdent. Learn how to highlight an entire line of code. Learn how to highlight all of the code from your cursor to the end of a file. Learn how to save the file. Again, it adds up.
My IDE Can Beat Up Your IDE!
It’s quite simple to know if you are using an IDE that will make you more efficient:
- You like to program in it;
- It’s not VI;
- It tells you the parameters (and data types!) for built-in methods;
- It tells you the parameters (and data types!) for the custom methods in your application; and,
- It colors your code.
Isolate and Toggle
The concept of isolate and toggle is a helpful way to speed up bug fixing (don’t worry, you will still spend more time fixing bugs than actual programming).
When you have a bug in your code, it’s caused by one or more outliers. Your job as a debugger is to eliminate each outlier until you find the root cause. You can only do this by eliminating each possiblity one at time. If you don’t, you might miss something.
Identify all the possible causes of the bug, isolate each one individually, and test (read: toggle your code) to eliminate each possible cause. One at time: isolate, toggle and test. Eventually, you will find the cause of the bug and you will know how to fix the issue.
Sure, sometimes it takes a little longer to fix a bug this way. But most of the time it takes a lot longer if you don’t.
One Step at a Time
Understanding and using the technique of small successful iterations is probably the single easiest way to be a more productive programmer. The idea is simple: when you code, code a little bit at a time then save (use a keyboard shortcut!), switch to your browser (use a keyboard shortcut!) and refresh (use a keyboard shortcut!).
Not even Carmack writes perfect code every time. You will make stupid mistakes frequently. So if you code just a few lines and test out those lines right away, you will know immediately where you need to look for the bug.
Query Editors
Using a good query editor is also a big help to productivity. MySQL has nothing compared the productivity gains from using Microsoft SQL Server’s outstanding SQL Management Studio. It is simply the single best platform for SQL development on the market, and a big competitive advantage for the Microsoft SQL platform.
The reason having a great query editor to use during development is a big productivity boost is that the alternative — writing the SQL in your application code — introduces a layer of abstraction complication between the database and your query. And this layer of complication isn’t designed to make debugging your SQL query any easier.
You can’t comment chunks out, run two similar queries at the same time and compare the results or see the results in the same window as the actual query. Worse still, it typically takes three commands (save, toggle and refresh) to see the results of a change to a query in your application code while you can get the same result in one command (execute) in a query editor tool.
Get Your Own Money Bin
The secret to becoming more productive at anything is to remember the lesson we learn from Scrooge McDuck: work smarter, not harder.