begin quoting Andrew Lentvorski as of Sat, Jun 03, 2006 at 04:10:30PM -0700:
> Stewart Stremler wrote:
>
> >The first thing I tend to do is to rewrite the code, but that
> >just offends the maintainers ("My code is self documenting. Why
> >did you go through and add vowels to all my variables?") -- and
> >I'm too lazy to fork a project for pretty code.
>
> Unless you wrote tests, I know that *I* would reject your code.
Surely I ought to be able to use the tests that come with the code.
> Rewrites without tests introduce bugs.
Rewriting logic, yes. Fixing up formatting, variable names, adding
comments (function, file, and module-level).... ought not introduce
any bugs -- far less, at least, submitting a patch to add functionality.
But you're quite correct that "rewriting" is often a quick way to add
bugs. Been there, seen that, glad I wasn't involved.
> >We'd discussed this awhile back, IIRC, in IRC. Stuff like starting a
> >peer-review process -- don't look at what the code does, look at how
> >readable, comprehensible, and maintainable code is. Encourage the
> >community to create code that _isn't_ painful to read.
>
> How about we start with code that actually functions? I will take code
> with tests any day over "readable" code.
I want both. If I had to choose... can I look at the tests and the
code first? :)
> I can rewrite code with tests if I really need to. If I am going to
> rewrite code without tests, I have to stop and write the tests first.
I'm seeing more and more code that doesn't lend itself to simple tests.
It takes a fair effort just to configure the environment to get the
damn thing to *run*.
Trying to write a test for that sort of application is a tad daunting.
What do you do when confronted with a program that takes a half-day to
set up before you can get it to run at all?
(Alas, 'throw it away' isn't always an option.)
> >And making someone else's code beautiful isn't rewarding work. Thus,
> >it's not often done.
>
> As well it shouldn't. Making code "pretty" is a case of premature
> optimization.
>
> "Pretty" == mantainable, IMNSHO.
?!
> The only way to determine which sections are not "maintainable" is to
> put it into production and see where the bugs pop up. Areas of code
> which have the most likely need to be rewritten.
Well, that's certainly an empirical test.
I'm seeing some hype about automated code-quality tests, and I'm
wondering if we aren't heading towards another annoying fad.
--
_ |\_
\|
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list