4 Lazy Ways To Stop Yourself Being Lazy

Here are four tricks I use to try and encourage myself to write the correct code at the right time.

  1. Use the Compiler to catch work that isn't done yet.
    • Before writing a method, write the code that calls that method.
    • That way, when I try to compile, errors will be reported for any methods that aren't yet written.
  2. Write a 'TODO:' comment.
    • That way I can still compile but can track down the items that aren't done yet.
  3. Write a Unit Test that catches each problem as it is foreseen.
    • That way while my code might compile, nUnit will tell me that the full story is a little more complex.
  4. Use Debug.Assert statements to hard-code your assumptions. Helps you find when your assumptions are wrong.

You can bounce from any one of these methods to any other. The order can go something like this:

  1. First write 'pseudo code' with each line labelled as 'TODO:'
  2. Convert the pseudo code into calls to fictional methods/properties. (Methods/properties that aren't written yet).
  3. Next, write the outline of these methods, but populate them with TODO's.
  4. Maybe now (or sooner) write unit tests to test the empty methods.
  5. As the tests are run, add some todo's or even some code to the methods.
  6. ...Continue compiling, writing, testing, planning -- all together.

The advantage of this kind of approach can be that it helps you capture your thoughts (getting-things-done style) before you get too bogged down in the implementation detail. And it does it in a way that leans on the tools available, to ease the burden on your memory.

Sooner or later you do of course have to write the actual code -- but using these tricks to scope out, design and view from a high level, can help you cut down and re-use code, long before you've spent time writing it.

 

My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.