|
Posted by Jerry Stuckle on 12/15/06 13:54
Tim Streater wrote:
> In article <fbednSbHwaH_IBzYnZ2dnUVZ_rylnZ2d@comcast.com>,
> Jerry Stuckle <jstucklex@attglobal.net> wrote:
>
>
>>Double Echo wrote:
>
>
> [...]
>
>
>>>but all the goddam schools preach shitmess roll-up coding and OO. It
>>>works but it's so fucking
>>>messy. You fucking kids think it's cool code, and wow, neato, but then
>>>somebody else has to
>>>work on it, and it's a fucking nightmare. Clean code, nested, and
>>>properly written will allow
>>>the code to be debugged better, and probably survive being re-written
>>>all over again because you
>>>can actually read it. I've gone on to delete code I can't read and just
>>>re-wrote it cleanly.
>>>
>>>-DE- ( using my best Dr. House imitation )
>>>
>>>
>>
>>Well, if "all the goddam schools" teach it, there must be something to
>>it, don't you think?
>
>
> It's just the vogue at the moment. Those of us who have developed a
> coding style over 40 years to assist maintainers who might be following,
> think different. Cool is not important - maintainability is (and
> donkeymentation, of course).
>
In your opinion, at least. Many others, including us who have been
programming 39 years (started with Fortran II on an IBM 1401) think
differently.
Some old-time programmers get so ingrained in one method it's hard for
them to see a different way of doing things might be better. Others
find new ways to be much better - including easier to maintain.
It's a matter of style.
> Personally I dislike something like:
>
> if (send_packet(params)) {
> do something
> }
>
> not just because of the braces but also because an "if" is supposed to
> perform a test - not have as a side effect as it might be sending a
> packet over the wire.
>
> -- tim
I love it, and use it all the time. First started doing in in C over 20
years ago. It's one of the great features of languages like C, C++,
Java and PHP, and allows for a lot of flexibility.
In your case the if statement is doing a test - but it's just a test to
see if an action (a dynamic event) completed successfully, instead of
the static value of a variable.
Let's take it one step further:
result = send_packet(params);
while (result) {
do something
result = send_packet(params);
}
Or, just
while (send_packet(params)) {
do something
}
After all, all a while loop is is a test which is executed repeatedly
until the condition fails.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|