Re: Factoring - a newbie question
- From: Jonah Thomas <j2thomas@xxxxxxxxxx>
- Date: Sun, 1 Jul 2007 14:19:59 -0400
"Robert Miller" <rsmiller@xxxxxxxxxxxx> wrote:
Is there any rule of thumb about when to factor lengthy words?
[....]
The target processor is a TI MSP430 and in this instance neither speed
nor space are important issues. Once the word is tested, readability
matters only if I (or someone else) have to revisit this particular
word - which I think is unlikely, but one never knows.
Ah, a trick question. You don't need speed or space or readability, and
the word already works.
So any change you make provides a chance that you'll introduce a bug
that you'll then have to fix.
There's even a chance that you'll introduce a bug that you won't find
right away, and then when it isn't fresh in your mind you'll have to
zero in on it and fix it, even more time.
And there's some small chance that the bug won't show up at all until
somebody else uses your code and they present you with a bug report. Big
problem for them and for you.
Balancing that, when you make the code simpler and more readable there's
a better chance that you'll fix an undiscovered bug than that you'll
introduce a new one. The only virtue of the more-complex code is that
it's been tested and used some, and you haven't noticed any errors yet.
So my natural thought is that if you have the leisure time to rewrite
this, and it's something you like to do, then go ahead. But if you have
something better to do, leave it alone. On the other hand, if you're
already spending time debugging then you might as well simplify.
Particularly when it looks obvious. Since you're rewriting your test
suite anyway, it might be less work to simplify than not to. Go ahead
and simplify whatever you can, and test it together, and maybe get a
much better product for a comparatively small effort. Time spent
simplifying is better than time spent debugging something complicated.
But only if you don't already have it stable.
.
- Follow-Ups:
- Re: Factoring - a newbie question
- From: Robert Miller
- Re: Factoring - a newbie question
- References:
- Factoring - a newbie question
- From: Robert Miller
- Factoring - a newbie question
- Prev by Date: Re: class sort
- Next by Date: Re: class sort
- Previous by thread: Re: Factoring - a newbie question
- Next by thread: Re: Factoring - a newbie question
- Index(es):
Relevant Pages
|