Break Your Coding Habits

I’m re-reading Mastery: The Keys to Success and Long-Term Fulfillment by George Leonard and I’m learning to love the plateau. If I were to chart my ability to create valuable code against time I would not see a gradually rising curve. Instead, the curve would be flat most of the time punctuated by occasional jumps to a higher level.

For Leonard one of the 5 keys to mastery is intentionality. I find it easy to slip into coding habits that keep me on the plateau. Whenever I create a new class I’m applying these habit-breaking rules:

  1. No implementation inheritance.
  2. Do not use the new keyword to create any objects.
  3. No getter and no setter methods.
  4. No boolean arguments.

Of course, it often makes sense to create classes that intentionally violate these rules. However, just for now, if you find yourself wanting to violate one of these rules: Stop. Are you violating the rule out of habit or do you have a good reason to violate the rule?

Code that follows these rules is more valuable than code that does not. I’ll be explaining my reasons in subsequent postings.

1 Comment

AnonymousSeptember 13th, 2006 at 3:01 am

So what’s wrong with “new”?

Leave a comment

Your comment