On Apr 19, 2009, at 4:35 , Hendrik van Rooyen wrote:

 Brian Blais   wrote:

On Apr 18, 2009, at 5:44 , Hendrik van Rooyen wrote:

to untangle some spaghetti code.  He did not mention if
the spaghetti was actually doing it's job, bug free, which
IMO is the only rational test for the quality of a piece
of code, because it is the reason for its existence.
The aesthetics are, like all aesthetics, a matter of opinion.


Actually, I strongly disagree with this statement.
In my experience, there has been very very few
pieces of  code that I've written that I hadn't wanted
to *modify* at some point: extend it to a new set of
circumstances,  cover a different case, change the
output, etc...  The quality of a piece of code is not just
if it works right  now, but if you can reasonably extend
it for the future.

Your experience is different from mine - in what I mostly
do, which is struggling around in embedded assembler,
by the time the thing "works" it is stable, and I very
seldom have to go back to fiddle with it.

On the other hand, I understand what you are talking about,
but I think that the origen of the frustration that one feels
when having to battle with some old code, is actually inside
oneself - the code is the same, but I have changed, and I am
no longer the same as I was when I wrote it.

You're right about the person changing, not the code...for me it's mostly forgetting. :) I have found that python lets me re-learn my old code much faster (usually there is no re-learning necessary - just re-reading) then Perl, C, and Matlab.

As for fiddling with code, most of the code I write for work is for exploring ideas in theoretical neuroscience. Once you have something that works, and you understand the problem, the next things out of your mouth is "I wonder what happens if this is changed?". Change is the norm


In my defense of the goto, I would like to make clear
that I do not support its use to produce spaghetti.
In general, muddled thinking, coupled with expediency,
is what I think are the true precursors of spaghetti code.
The goto is an innocent tool that can be used for good
or evil.


as is true of any tool, but I think that the goto is a little too convenient for the sloppy thinker, and shouldn't be lying around to be picked up by just anyone. :)


                        bb


--
Brian Blais
bbl...@bryant.edu
http://web.bryant.edu/~bblais



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to