4 Lazy Ways To Stop Yourself Being Lazy
secretGeek .:dot Nuts about dot Net:.
home .: about .: sign up .: sitemap .: secretGeek RSS

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.





'Mischa Kroon' on Sun, 02 Jul 2006 14:12:53 GMT, sez:

Wasn't this TODO driven progamming :P



'Rik Hemsley' on Sun, 02 Jul 2006 18:55:29 GMT, sez:

I find this better than calling missing code (can't compile) or writing TODO in methods (can compile but code is broken):

Where you haven't done something yet, throw a NotImplementedException (or equivalent).

Assuming you write your tests first, this will mean your code compiles but your tests fail - which, I think, is most useful. You can use the build but you wouldn't think about releasing it or checking in.



'lb' on Sun, 02 Jul 2006 20:49:12 GMT, sez:

>Wasn't this TODO driven progamming

yeh, it's just got two new tool-assisted-features: asserts and unit tests.

i don't mind throwing 'NotImplementedException', but if you've already written your unit tests, is there still a need to throw the exception? the test should fail as is... this is about laziness so adding those throws looks like extra work...

i *do* like visual studio's habit of throwing 'NotImplementedException's inside methods it creates for you, but that's an automated thing, and suits laziness well...

And how about the SapphireInSteel hey?

cheers
lb



'Michael Leung' on Tue, 04 Jul 2006 03:03:21 GMT, sez:

Hey Leon,

I haven't commented on here in a dog's age. This seems like a pretty solid way to approach development. I think I'll give it a shot perchance as I'm still not fully drinking the TDD kool-aid. I write tests, but usually after the fact. :)

Oh, and ShappireInSteel?

What about good old (well new) RIDE-ME?



'lb' on Tue, 04 Jul 2006 03:26:40 GMT, sez:

Good to see ya back again!

thanks for adding the link to "RIDE-ME" in your name. If i was gonna google that name, i have a vague suspicion that a lot of the result wouldn't be safe for work ;-)

Project ride-me looks groovy!



'Michael Leung' on Tue, 04 Jul 2006 04:42:28 GMT, sez:

Thanks buddy! :)

I took about a three or so month hiatus to write RIDE-ME and do some Rails work, but I'm coming back in a big way!

Oh, and results to the RIDE-ME search are definitely not conducive to work browsing. ;)




name


website (optional)


enter the word:
 

comment (HTML not allowed)


All viewpoints welcome. But the right to delete any post for any reason is reserved. Don't make me do it. Aim for constructiveness. Comments may be republished, emailed to your loved ones or printed and used as toilet paper. Also, I get particularly nasty on comment spam. It's not worth even trying to post comment spam here -- your html is escaped, and your links are given a rel='nofollow'. By attempting to post a comment, you understand that if the comment is considered spam, at my absolute discretion, your IP address may be used as the target of a prolonged distributed denial of service attack. Your electricity might suddenly stop working. Your car tyres will go mysteriously flat. You will suffer permanent hairloss. Your dreams will be filled with terrifying monsters. And in any case I reserve the right to record and publish your IP address.

 

TimeSnapper is a life analysis system that stores and plays-back your computer use. It makes timesheet recording a breeze, helps you recover lost work and shows you how to sharpen your act.

 

NimbleText - FREE text manipulation and data extraction

NimbleText is a Powerful FREE Tool

Use it for:

  • extracting data from text
  • manipulating text
  • generating code

It makes you look awesome. Use it right now! Go on! Hurry! Don't walk, run!

 

Articles

Just Wally Just Wally
The Correct Order for a First Time Viewing of The Lord Of The Rings The Correct Order for a First Time Viewing of The Lord Of The Rings
A new era for Android. A new era for Android.
Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes. Got CSV in your javascript? Use agnes.

Archives Complete secretGeek Archives

TimeSnapper -- Automated Screenshot Journal TimeSnapper: automatic screenshot journal
NimbleText -- World's Simplest Code Generator NimbleText: Code Generator, Text Manipulator, Data Extractor

25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Universal Troubleshooting checklist Universal Troubleshooting Checklist
Top 10 SecretGeek articles Top 10 SecretGeek articles
ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Realtime CSS Editor, in a browser RealTime Online CSS Editor
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker


[powered by Google] 


How to be depressed How to be depressed
You are not inadequate.



Recommended Reading


the little schemer


The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
Thomas White
OJ Reeves
Eric Sink

Aggregated Links

proggit
dzone
hacker news
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
weekly link post

LinkedIn profile
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
PhysioTec, Brisbane Specialist Physiotherapy & Pilates
 
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2006 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2006 .: privacy