Re: Current Issues with perlipc.pod - should they be fixed?
[email protected] (Shlomi Fish) Mon, 6 Dec 2010 20:45:01 +0200
| Newsgroups | perl.perl5.porters,perl.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Monday 06 December 2010 19:49:44 Abigail wrote: > On Mon, Dec 06, 2010 at 07:34:35PM +0200, Shlomi Fish wrote: > > Now I think that some of my style/best-practices suggestions are an > > improvement and I'd like to pursue them. > > And I'm strongly against that sentiment. > > I really do think p5p, and hence the documentation, should *not* have a > style preference, or have some form of "best practice" (nor do I believe > you'll find consensus on what "best practice" will be). Style guides, > coding standards, best practices, or whatever you want to label it only > gives rise to coding police, and it's only fuel to people who only answer > questions on usenet or Perlmonks with "well, for starters following these > as these rules", regardless whether that helps answering the question > or not. Well, I don't frequent either Usenet or Perlmonks, but let me answer. (For the record, I help a lot on IRC and on mailing lists.) I've collected a longish list of bad practices to avoid (from PBP and other sources) here: http://perl-begin.org/tutorials/bad-elements/ Now, I've specifically tried to make it as non-controversial as possible and avoided recommendations that are a matter of taste, and can be done this way or another. If you think all style guide / best practices / etc. are not helpful, will you accept code that: 1. Lacks all indentation? 2. Has magic numbers such as: my $n = uc($_[3]); ? 3. Has comments or even identifiers in a non-English language? 4. Has duplicate code? 5. Has inconsistent tabs and spaces and looks differently aligned on many tab widths? 6. Has non-descriptive variable names? Reportedly http://en.wikipedia.org/wiki/Daniel_J._Bernstein uses many single-letter and double-letter identifiers in his code. --------------------- I know none of these will be acceptible to me, because they are not a matter of taste, but rather objective measures of the internal quality of the code. However, there are a lot of style debates, like which indentation style to use, or whether to do my ($self, $args) = @_; or my ($self, %args) = @_; or whether one should avoid using "unless" instead of of "if (!)" altogether (which I do), or whether one should avoid trailing conditionals (which I also avoid), etc. etc. These are still a matter of preference and mostly amoral, and are not covered in my document. Now the question is which category making the code strict-safe or using lexical filehandles belongs to. People have given good arguments for both of these for many years now, so I think they belong in the things that p5p will necessitate in code examples (unless someone has a compelling argument why they are not a good idea). Regards, Shlomi Fish > > Pursue all you want. Just expect feedback which may not agree with you. > > > > Abigail -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Rethinking CPAN - http://shlom.in/rethinking-cpan <rindolf> She's a hot chick. But she smokes. <go|dfish> She can smoke as long as she's smokin'. Please reply to list if it's a mailing list post - http://shlom.in/reply .