CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

Wrestling with pure evil

1.) Very long method

+

2.) Non descriptive variable names

3.) Variables are reused for different things throughout the method

4.) Lots of if/then exception cases

+

5.) Deeply nested Arrowhead code

+

6.) All data stored in Hashtable's -- and it's this data that's getting bamboozled somewhere

+

7.) Numbers that come out wrong

=

An unpleasant Friday afternoon. 

I worked with a developer one time who took an inordinate amount of pride in his debugging prowess and ability to make bad code function.  I could have really admired his ability if I hadn't been so busy cursing him for the code I inherited from him.  I think I'm getting more tolerant of other people as I get older, but less tolerant of bad code and code friction.

The next time I do greenfield development I promise to appreciate it.


Published Sep 21 2007, 02:12 PM by Jeremy D. Miller
Filed under:

Comments

Harry said:

Hey, I learned something. To code-better, I have to avoid things listed here.

This is a good post.

# September 21, 2007 4:23 PM

MToddSmith said:

Sounds like job security 101 to me :D

# September 21, 2007 4:41 PM

Jeremy D. Miller said:

G,

To make amends, I've got a post in the pipeline that's all about fixing/preventing the stuff I was whining about today.  Look for it soon.

# September 21, 2007 6:03 PM

Dave Laribee said:

i think your complaint/solution ratio speaks for itself.

# September 21, 2007 6:15 PM

Bil Simser said:

Sucks to be you. Just kidding. Sounds like a crappy way to end the week, but look on the bright side.

It could be Monday.

# September 22, 2007 12:23 AM

Vlad said:

Just refactor...

# September 22, 2007 5:18 PM

Jeremy D. Miller said:

...no tests & not knowing what the code's supposed to do == no refactoring

# September 22, 2007 5:37 PM

Mike said:

What year was the code origionally written?

# September 23, 2007 10:44 AM

Jeremy D. Miller said:

Mike,

The code isn't really that old, but it was written by an analyst, not a developer.  The analyst wasn't given any help from a developer at the time.  

All of the absolute worst code is written by very bright, very creative people without experience.  The real failing of that organization was putting somebody in a position to fail.

# September 23, 2007 11:31 AM

Ollie said:

Arrowhead code? - care ot explain...

# September 24, 2007 11:49 AM

Jeremy D. Miller said:

if

{

   if

   {

       foreach (...)

       {

           if

           {

                while (...)

                {

and back down again.  The simple cure is Composed Method.  codebetter.com/.../Composed-Method-Pattern.aspx

# September 24, 2007 12:15 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

Our Sponsors

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP