Hi,
as I mentioned in this thread(
awk - function to return permutations of n items out of m), a helpful coding style may improve overall value and support for people who come here and want to learn things the participants from unix.com have to give.
Personally I'm more out of corner of structured programming. And maybe that's not that quite compatible with awk as you may see it or "Steve" had written it on his website:
Steve's Awk Acadamy . So I think I myself am still in the learning phase of awk about the paradigm it uses and in the phase of letting go other paradigms useful for other environments.
As Scrutinizer wrote in the mentioned thread: "Sometimes he has only a couple of minutes" and thatswhy he tries to keep the balance between available time and a helpful solution. That's nothing I'm critizing. I appreciate everyones effort how big or small it may be and there is for me not one right way how to do it.
I just want to ask everyone if there are qualities in the coding snippets that ...
- support easier learning expecially for users with less or no experience at all
- can make unix.com an even better collection of easy understandable code snippets as a valuable knowledgebase
- do not lure new users into bad programming methods
- (other suggestions what can be achieved by good readable code?)
Specially for new users I think it maybe more difficult than one, who has 10+ years experience in this profession, may imagine. This does not mean all and everything has to be written in a "to be defined" style but just to acknowledge that this and that may improve it and if one has time and appreciates it, he does it that way.
In my view, these are:
- use of mnenonic variable names(not done here)
- tidy indentation and clean code formatting(always done here)
- use colors to mark important code-spots(often done here)
- attach explanations to the code(sometimes given directly, always given detailed when requested)
For me personally it's still helpful to have mnenonic variable names since I do not have the functions and parameter ordering in mind, even if I think I got it slowly now without reading the manual again.
About that "luring new users into bad programming" I mean that "global variable" thing. For small awk scripts even production it maybe best-practice to do so - I have not that bad opinion about that. "Hell that's only 20 lines of code! Why should I bother?" But if one's here and always reads the code and intuitively takes with him/her what he/she learned here, because he/she read it a thousand times? I assume every good programmer has a healthy view on that topic, especially the ones writing here.
And last I would say that the effort which is done by the longer contributing users here to produce clean code seems very high to me. So this is a proposal on an already high level of quality here.
Regards,
stomp