Tips for becoming a faster developer
One of the common complaints that I’ve been hearing about our industry is that our industry lacks quality in general. The evidence of this is this never ending cycle of rewriting software over and over because it is unmaintainable, buggy, etc. Many people would say that this is sometimes a result of developers throwing code together quickly without taking the time to think out their design, write unit tests, or manually test their code.
Thankfully the pendulum seems to be swinging and people are starting to expect higher quality from themselves and from the people that they work with. More and more people are jumping on the TDD bandwagon (at least the people I work with are).
However, speed is still very important — that is, the amount of time that it takes a developer to complete a task or the amount of time that it takes for a team to complete a project. The fact of the matter is that we all have deadlines for our projects (well, maybe not if you’re working on open source projects). Hopefully those deadlines are realistic, but they are deadlines that we have to meet. So quality is definitely important, but speed cannot be ignored.
It seems to me that there is a stigma against developers who say that they work fast. It seems that if you walk into an interview for a developer position and you say something like, “I’m capable of getting a lot of work done in a short amount of time,†you might as well keep looking because the interviewer will often times assume that you write crappy code and don’t care about quality.
But what if you are able to work quickly and not compromise on quality? That would be the best of both worlds! Just like we should all strive to write better quality software, we should also strive to get it done in as quickly as possible (without compromising on quality, of course). Here are some ways that you can do this:
Become a keyboard ninja
They put those keyboard shortcuts in Visual Studio for a reason, you know. If you’re writing .NET code you’re probably spending most of your day using Visual Studio (or another IDE if you’re using another language). So why wouldn’t you take time to learn the keyboard shortcuts? If you are using ReSharper (and you all should be), there are even more keyboard shortcuts to help you.
When I got my first job, I worked some guys whose goal was to never use the mouse. These guys knew the keyboard shortcuts for everything, and they sure could get around fast. Watch somebody who uses the mouse a lot, and watch how long it takes to stop typing, grab the mouse, drag and click, and go back to the keyboard. It totally takes you out of your rhythm.
If you want to learn to use the mouse less, it really isn’t that hard. Go print out the keyboard shortcuts for Visual Studio or ReSharper and tape them up at your desk. Then anytime you reach for the mouse to do something in a menu or a toolbar, look on your cheat sheet and find the keyboard shortcut. Highlight it on your sheet so that it’s easy to find next time. You’ll be a keyboard ninja in no time.
Create easy-to-use frameworks
I’ve been on projects where it was really difficult to do simple tasks because the application’s framework put so much burden on the developer because it was way too over-complicated. Sometimes things have to be complicated, but many times they don’t have to be. When I’m designing frameworks, I will spend more time on writing framework code if it will make life easier for the developer using it. Frameworks should help developers get things done, not hinder them. The success of your project may hinge on this.
Use code generation tools
If you find that you’re doing a repetitive task over and over again, take the time to set up some code generation templates to help you generate that code. There are many ways to do this:
- Code generation tools like MyGeneration
- Visual Studio code snippets
- ReSharper Live Templates (code snippets on steroids)
- Visual Studio file templates
Don’t get stuck writing plumbing code over and over again. Usually there is some repeatable pattern that you can recreate using a some kind of code generation tools. Every developer should be at least somewhat familiar with these kinds of things.
Control distractions
There are lots of things that can distract you while you’re writing code, like meetings, emails, IM, Twitter, etc. Sometimes you can’t always control these (e.g. meetings) but the rest are under your control. The world is not going to end if you can’t check your email, send IMs, follow Twitter, etc. for a day. I’m not saying that you should always shut those off. I’m just saying that we all need to be careful that they don’t become a distraction. It’s really easy to get caught up in discussions on Twitter, but remember, you’re being paid to produce, not discuss things on Twitter. (If you are getting paid to participate in discussions on Twitter, then lucky you!)
Buy ReSharper
I think I’ve already mentioned ReSharper several times now. It’s only $199 for a personal license. I don’t know how I wrote code for so long without it. My company bought a license for everyone on my team and it was the best money they ever spent. Some of the refactoring tools and keyboard shortcuts are really useful if you’re doing TDD and creating a lot of interfaces.
For picking up keyboard shortcuts, I’ve taken to writing 3 or 4 on a post-it note and sticking that to my monitor. I usually leave it there for a week, and it worked pretty well for me.
Don’t forget VS2008’s T4 templates. It’s kind of like having MyGeneration or CodeSmith built right into Visual Studio.
“If you find that you’re doing a repetitive task over and over again, take the time to set up some code generation templates to help you generate that code.”
Aside from the most basic code situations like creating a web service or creating property bags or validators etc if you find yourself writing the same code over and over again it’s due to poor design. Most times any code that is ever rewritten that isn’t the most base layer of development can be abstracted away with inheritance or delegation.
I am a firm believer of “The best line of code I ever wrote was the 10 I didn’t.”
@Chris,
You could be right, but we all do repetitive things on any project. For example, you may create entity classes that derive from a base class and override two methods. You could generate that class so that developers would have something to start with. We did this kind of thing so that most of the time you have a template that you can pick when you add a new file that will get you to the starting point so that you don’t have to do the initial repetitive crap.
That was nice,, Keyboard shortcuts are my favourite. I have defined lots of custom shortcut for my apps. Now I am changing the job & need to export those :)
Really nice posts. I will be checking back here regularly.