It's really interesting to hear the opinion that following patterns religiously can also lead to "bad" code.
The thing to remember about patterns is that they're meant to be descriptive (a way of communicating what you're doing to other programmers) rather than prescriptive (a way of telling you what you should do). Bad code frequently results when you take a list of patterns and decide to use them purely because they've been blessed as Patterns(TM) rather than analyzing your problem, looking to see the most appropriate way to solve it, and then using patterns to express that solution.

There's also the side issue that patterns are generally ways of filling gaps in the language that you're using (Perl has no patterns for finding text which has certain characteristics within a string because the language's built-in regex support is better than anything you're likely to write in your application code), so problems also arise from inappropriately applying one language's patterns in another language which has a better way of solving the problem at hand, but that seems to be a less common cause of pattern-derived bad code.


In reply to Re^2: Programming patterns by dsheroh
in thread Programming patterns by McA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.