Quantcast
Channel: dustin – Dustin's Stuff
Viewing all articles
Browse latest Browse all 24

Get Your Fingers Moving

$
0
0

When you’re blocked in your programming, you may be tempted to try to get your brain in gear, hoping your fingers will follow suit.  You have it backwards.  I’ve become convinced that, short of high doses of caffeine, the only way to get your brain in gear is to just start writing code or creating some other artifact.

When you’re dealing with an existing codebase, or if you’re a fan of unit testing, your impulse might be to write code in small pieces, making sure each one works before starting the next. Sometimes this makes sense, but if this were one of those times, you probably wouldn’t be dealing with a mental block.  You’re probably at work, with a deadline, and you’re convinced that if you could just get out of here, you’d be ten times more productive–after all, you become ten times more productive after everybody goes home.

Your brain is a communication machine.  The ability to think is just a side effect of having to have something to talk about. So get your fingers moving. Your brain will catch up.  Prefer adding new code over editing old code. Back your existing code up, and create a new branch in your version control system, so you can write freely without worrying about what you’re trashing. The time for testing is later; the time for writing is now. Write code that you think will run, but whatever you do, don’t try it until you get the whole thing written. I call this protocode.  You should have a sandbox area on your version control server for this kind of stuff.

If you can’t get you fingers coding, draw diagrams.  If you have no room on the whiteboard, copy it down and erase it.  If you can’t get the diagrams out, write a description of how it should work, or what it should do, or how you’ll know when it’s done.

When it’s done. Then. Try to run it. Fix your syntax errors and your mismatched parameters. Check that it seems to work. Instrument it for more rigorous testing. Do the testing and check it in.  Make it into a building block for for future use.

There’s a limit to how much you should do without testing. It’s probably bigger than you think.


Viewing all articles
Browse latest Browse all 24

Trending Articles