|Keep It Simple, Stupid|
RE: (jcwren) RE: RE: luke_repwalker.plby tilly (Archbishop)
|on Aug 06, 2000 at 15:52 UTC||Need Help??|
One of the nice things about dealing with good programmers is that while they may be annoyed at suggestions, they can tell when a suggestion is good and respond to that.
I could tell your code was good, and I am not at all surprised that you knew most of what I could suggest. Indeed my main reason for responding was not to give you useful advice (though that is good), but rather to make others reading this aware of the fact that even good code can be improved. Also there is a difference between seeing code that is good and being able to see why it is good, and commenting on why code is good helps people learn that.
As for asking who I am, well do I recognize that response in myself. :-) Truth be told, I have less experience than you, over fewer years, in fewer languages. But I am smart and I try very hard to learn when I can. Hopefully at some point I will post some code and you will will do the same... :-) Tye already explained how to take extract a list from a hash, which leaves us with two issues that I would like to mention.
The less touchy is "or die" in item 5. Perl offers many choices here, by all means pick the one you find matches your thought pattern best. This is one of the cases where I sometimes find that "unless" works for me. Mixing unless with any and's, if's or not's lends itself to great confusion. But an "or die" could be missed, and unless indicates that you do not expect it to happen while if(!...) doesn't do that for me. So TIMTOWTDI, pick what matches your mind.
And now for the controversial layout question. As we both know, layout is one of those things that people develop very strong opinions on. So let me describe where mine come from.
I used to feel as you do. I read Code Complete and came out saying the same thing. As long as it fit on one line in my editor on my nice screen, I was fine.
Then one day a co-worker popped my code up in vi in his machine where real-estate was being used for lots of terminals in fairly large fonts. (He doesn't have the best eyesight in the world.) My jaw fell open and I immediately apologized. Literally the first thing I did when I went back to my desk was I found a way to put a line at 79 characters on my screen and I began paying attention to it.
You may disagree. In fact I know of good reasons to legitimately disagree. As we both know there is huge value to being able to put as much code on screen at the same time as possible. On your computer, for you, your layout does that. As soon as code goes out of sight it is out of mind and bug counts rise. I understand, and indeed if anyone finds an easy way to split X so that it works like one window that is half as wide and twice as long, please tell me. I would use that in a heart-beat. :-)
Now you like your layout because you see it in your modern editor on your huge screen. Well I am seeing it in a crappy browser on a laptop chosen for its form factor. Did you want me to be able to read it? :-)