Tradução em Português

Oftimes, when Monks seek Wisdom, they are admonished by fellow Monks to make sure they have their FAQs straight, or worse, told to RTFM. However, new Monks are often intimidated or confused by the information available and are hoping for a clearer explanation. Also, the newest of the new often don't know where to find documentation.

I am perfectly willing to grant absolution to a fellow Monk for such venial sins. However, there is one sin that verges on mortal: failure to reduce your problem to a minimal test case.

Several examples are this post by vnpandey, this post by the ubiquitous Anonymous Monk, and also this node which isn't even Perl, but is the output from make install! These posts contain in excess of 250 lines of code.

Now contrast those nodes with kudra's recent post. kudra took the time to to reduce the code to a minimal test case so that we could focus on the problem and not be distracted. All monks should consider this. There are several benefits to this.

  1. You don't annoy fellow monks (that link is a joke. I personally like the kid).
  2. You don't find yourself in the Hall of Shame.
  3. Monks are more likely to offer assistance.
  4. And most importantly: you can focus on the problem.
That last point is critical. You can even forget the other three. More than once, in trying to isolate a problem, I have attempted to strip it to a minimal test case. Often, by removing clutter, the problem has stood out like a beacon. Other times, by stripping "irrelevant" code, the problem has gone away and I found the "irrelevant" code to be the problem.

So please, let's try to be more considerate and reduce our code as much as is feasible before we post. You'll learn more about your code, about coding in general, and are more likely to have relevant answers to your questions.