Subj : Re: Syntax, style, the infinite monkey theorum and coding To : comp.programming From : Chris Sonnack Date : Mon Aug 22 2005 12:20 pm gswork@mailcity.com writes: >> how about a C program with a seven page while() loop where the >> condition on the while() loop was seven full lines long (where full >> means about 70 characters per line, not counting whitespace)? > > I like the idea that a condition can be seven lines long! Now > that's a condition! I wonder if there wouldn't have been some way to abstract away some of the predicates into functions. Even if there were a lot of predicates, I'd almost be tempted to do something like: object Temp var p1 = some_long_variable_name var p2 = another_long_variable_name --etc end object while Test_Predicates(Temp) --do loop stuff end while --somewhere else function Test_Predicates(object T) --test the predicates end function Or the more OOPLish: object Temp var p1 = some_long_variable_name var p2 = another_long_variable_name --etc function Test() --test the predicates end function end object while Temp.Test() --do loop stuff end while Factoring the while expression into a function (and sub functions if it makes sense) probably makes the thing a lot easier to understand, which makes it easier to maintain and troubleshoot. The flip side is there is *some* performance penalty, but that may or may not be important. That requirement needs to be set against the requirement for writing maintainable code (which is in my mind always a very high one). -- |_ CJSonnack _____________| How's my programming? | |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL | |_____________________________________________|_______________________| .