|Welcome to the Monastery|
RE (tilly) 3: On elegant coding...by tilly (Archbishop)
|on Oct 16, 2000 at 17:00 UTC||Need Help??|
I am not the greatest fan of state variables either. But the state variable always was initialized, information on what values were legal appeared fewer times within fewer lines of code than the original, and I was only resorting to it to remove something else that I disliked even more. And I note that it is an idea that you tossed around as well. :-)
To tell the truth, were this my problem with my stuff I would look at the logic and reconsider whether I need to be fancy and fork. Since my stuff likes to run in crons and long-running jobs, I would be able to say "no" and get drastic simplifications. Down to "until it is safe to read, become writer and be sure it is fixed, once safe to read then read".
But there is an obvious solution that doesn't involve state, and that is to make your loop into a real function, and then return out of the function rather than call a function that exits. Combine with runrig's organizational skills... :-)
As for the diner, yeah, that hits home. And you know it. So let me explain.
It has to do with my learning style. I found out many years and subjects ago that I learn best by going out and finding out everything that I can, trying to integrate that into a solid understanding, and then articulating my understanding in the presence of people who know better than I do. If they correct, then analyze the corrections, integrate *that* into my understanding. Wash, rinse, and repeat until satisfied.
Which boils down to one thing. I am a lot like that guy at the end of the counter except in one huge detail. I learn!
Besides which, I have been more places than you might think...