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

Jeffrey Palermo (.com)

Blog moved to www.jeffreypalermo.com

First make it right. Then make it fast.

To subscribe to my feed, add the following Url:  http://feeds.feedburner.com/jeffreypalermo.

I spent the first part of my career on the side of the fence where I want to make it fast first.  In fact, I wanted to keep it fast all the way through.

I'm talking about software.  Performance optimization.  Speed. 

There was a time when every time I concatenated a string I weighed the theoretical pros and cons of using the plus operator vs StringBuilder vs. string.Format().  I even measured differences.  I've now come to the point where I realize that PDD (pain-driven development) is the real decision-maker.  It's no longer worth my time to think about what concatenation method might be faster.  Compared to a single database call, the speed different is irrelevant.

Point:  A well-designed application can be tuned at any conceivable place after it's working correctly.  An application that has "performance optimizations" coded into it from the start has less flexibility for the inevitable bottleneck that surfaces unexpectedly.

Point:  I will not guess at what part of my code will be a bottleneck unless I have past experience in the exact same scenario.  Rather, I will lead the team to create correct software that _appears_ to be fast enough throughout the project.  At an agreed-upon time we'll profile (with the appropriate tools - yes, I mean _measure_) the application and find any bottlenecks that are not acceptable for production.  Then, with real data in hand, we'll tune exactly the right parts of the application.  We will not guess before measuring.  After measuring, guessing is not necessary.

Point:  First make it right.  Then make it fast.

In general, out of process calls are performance bottlenecks, not in-process logic.  Either way, measuring tells the truth, not guessing.



Comments

Peter Ritchie said:

Picking the a known faster algorithm is not premature optimization.

# February 11, 2008 3:12 PM

Jeffrey Palermo said:

@Peter,

You are correct.  Picking a known faster algorithm is not premature optimization.

# February 11, 2008 3:19 PM

Ayende Rahien said:

About the only time that I think performance when I am writing code is for out of process calls (that include DB queries).

I tend to try to minimize those up front, usually by designing the interfaces between the two appropriately.

Other than that, whatever works, and optimize later.

# February 11, 2008 4:58 PM

Kevin Radcliffe said:

My own experience with this has been very similar.

I've seen many situations where the profiler ended up making a fool of me (THAT was the bottleneck!?).

My own optimizations usually made negligible performance difference and often caused some loss of readability.

I'm still working out what is "right", but at least the readability and maintainability of my code has improved.

# February 11, 2008 4:59 PM

vikram said:

Yes important to build a correct system first and look at performance later, But performance should not be negelected later on......

# February 12, 2008 1:59 AM

Unknown said:

Make it correct, make it clear, make it concise, make it fast.  In that order.

# February 12, 2008 6:45 AM

Jeff Handley said:

I agree completely.  The PM on my current project has a good philosophy:

1. Make it work

2. Make it stable

3. Make it fast

4. Make it pretty

# February 12, 2008 7:42 AM

Eric said:

Post like this make me wonder about the talent in the market place. First off, there is no one rule for doing any one thing first. Of course you want to do it right first, if you didn't why bother in the first place. We are the only industry that the workers analyze ever single thing they do and try to come up with one answer. Good thing the guys working on my house didn't spend the time analyzing what they should or should not do first.

# February 14, 2008 8:41 AM

Sanjay said:

Totally agree, and specifically with the overall opinion and especially with Jeff's order of priorities.  I actually posted a similar thought on my blog quite some time ago (geekswithblogs.net/.../84903.aspx)  and met with some resistance.

# February 14, 2008 9:54 AM

Kris Brixon said:

@Eric

The guys working on your house DID analyze what should be done first. They just did it on previous houses and learned from previous contractors. I am sure they did not put up the drywall before the wiring or install the roof before the foundation.

I have heard in the past:

1. Make it Work

2. Make it work Right

3. Make it work Fast

# February 14, 2008 2:44 PM

Interesting Links of the week(Feb 15th 2008) « Rambling said:

Pingback from  Interesting Links of the week(Feb 15th 2008) « Rambling

# February 15, 2008 8:16 AM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

This Blog

Syndication

News

Headspring Systems

View Jeffrey Palermo's profile on LinkedIn

See my new blog at .jeffreypalermo.com