my guess if
you never wrote reuseable code
Ah... you subtly changed it from well engineered
code (i.e. not
throwaway shit that noone can understand)
Actually, for some purposes throwaway shit _is_ well-engineered code.
Good engineering is about building it suitably for its use, not about
building it to some sort of idealized "all code should be like this"
target.
When the purpose of the code is to, for example, verify that your
understanding of some aspect of the language is correct, or when you
need to compute a constant that will go into the final code as a
constant, or some such, then the code _is_ throwaway, so making it
anything else is wasted effort.
(Unfortunately its author rather ruins the effect by making one of the
most annoying (to my eye) rudimentary English blunders on the net
today, namely, using "loose" as if it meant "lose".)
I agree with the sentiments here: a lot of code is
written with the
intention that it will be reused, but it never is. So we paid for
something we didn't need.
Yes and no, I'd say. The page you cite touches on this when it says
One of the reasons developers want to "design for reuse" is not
so much because the code will be reused but rather because they
desire a set of properties (modularity, high cohesion, low
coupling, etc.) which are desirable engineering properties but
sound a bit abstract.
Designing for reuse and designing for maintainability, while hardly
identical, do overlap heavily. In particular...
Agile/XP practices (i.e. YAGNI) say don't design
for reuse until you
need reuse.
...I consider this a dangerous idea. There is certainly some truth in
it, but I think it is dangerous because designing code without any
thought of reuse has a nasty tendency to result in code that is
extremely hard to reuse, often needing a complete discard and rewrite.
Designing code with reuse in mind, while not necessarily resulting in
reuse-ready code, does produce code that is much easier to reuse later.
Someone upthread wrote that "reuseable code is define as code that can
be used without any code changes across many different unrelated
applications"[sic]. I disagree with this definition; I see reusability
as a spectrum, not an absolute, running from what that quote describes
through code that needs a few minor tweaks and code that needs major
tweaks all the way to stuff that is best scrapped and rewritten rather
than reused at all.
So, I would say, don't make it fully reuse-ready; that is wasted
effort. But write it with reuse in mind. Do this because that
produces more maintainable code in general. And, in many cases, it is
actually the cheaper option. If we let the chance of needing to reuse
the code be R, the cost to build it without even thinking of
reusability P1, the cost to build it with reuse in mind P2, the cost to
overhaul it for reuse (in extreme cases, this means scrap and rewrite)
P3, and the cost to update it for reuse when built the second way is
P4, then, if P1+(R*P3) > P2+(R*P4), you're better off building for
reusability, as in, writing it with reuse in mind even if you don't
actually make it reuse-ready.
And, at least in my limited experience, that inequality is often true.
PS: Please stop turning my perfectly good ASCII into
useless
non-ASCII. (\xa0? WTF?)
>> Based on what?\xa0 Again, this is not in line with my
0xa0 is the 8859-1 non-break space character. This is probably an
artifact of a MUA that's been "improved" to the point where it's too
stupid to comprehend the concept that quotes should be a literal quote
of what was written, rather than what was massaged into some other form
to get it past display code that's also been "improved" to the point
where subtrefuge has to be used to display straightforward text.
The message-ID in your In-reply-to: and References: is
<1357143740.29987.YahooMailClassic at web120004.mail.ne1.yahoo.com>, which
makes it look as though this was written by someone using Yahoo's
webmail interface, in which case none of this misbehaviour is any
surprise at all to me. Webmailers generally do not understand email,
instead trying to shorehorn it into their "everything is the Web and
the Web is everything" mindset, leading to damage like that. (That's
hardly the only damage; I went back and looked up the message in
question and found it (a) added spurious linebreaks to text it quoted
and (b) used paragraph-length lines for its new text.)
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at
rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B