View Single Post
Old 08-20-2008, 03:37 PM   #148 (permalink)
ishiyakazuo
Test Tool Engr.
 
Join Date: Aug 2008
Location: Elgin, IL, USA
Posts: 47

Red Rocket - '02 Honda Civic LX Sedan
90 day: 33.57 mpg (US)

Bronze Bucket - '98 Toyota Corolla VE
90 day: 34.97 mpg (US)

Silver Bullet - '06 Hyundai Sonata GL
90 day: 31.58 mpg (US)
Thanks: 0
Thanked 0 Times in 0 Posts
You have a point, but I've been bitten too many times by not thinking up front about designing a basic API first. Design helps things get done faster and easier -- the problem is that once something is working, refactoring NEVER gets done by the person/people who made the original code. In my experience, it tends to cause a situation where new people who inherit the code don't want to change things either because they think might have some hidden magic, or because they don't want to cause offense to the original authors. So usually you wind up with a lot of hacks stitched on because the original code wasn't planned out for future enhancements.

Put simply, one of the worst things you can do in code is not break things out into pieces. And another is breaking things down too far. (Funny how it works that way.)
If you don't break things out enough, you wind up with a lot of code that's difficult to read (functions that are too long that really aren't performing a specific function, etc.).
If you break things down too much, you'll probably find yourself copying and pasting little pieces of code all over the place.

But anyway, you're right -- we need to get MPG showing. My understanding is that there's two basic methods, and if those fall through, you're in trouble. For cases such as that, I'd recommend having a function like GetMPG( lcdLocation ) which just knows how to get MPG using the current setup and puts it on the LCD somewhere nice.
  Reply With Quote