Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good newbie instructions for creating minimal complete bug examples? [closed]

Tags:

debugging

So, those of us who've been answering questions and dealing with bug reports for a while are all deeply familiar with the concept of a "complete, minimal example". You start with a gnarly huge pile of code that's got a weird error, and you want to ask someone about it. But you don't want to send them the whole mess, so you start cutting the pile of code down into smaller pieces, until you get this little crystalized 20-line gem that still has the same bug you started with.

(And then, at least half the time, you realize what the bug is because it's staring you in the face like a luna moth, and you don't have to ask after all. But that's a side effect.)

Doing that sort of code-reduction isn't a skill that everyone has -- it takes a bit of practice, beyond the fact that a lot of newbies haven't yet learned that they ought to do it in the first place. There are several excellent sets of instructions for newbies on how to ask good questions (e.g., ESR's classic "How To Ask Questions The Smart Way"). Are there good instructions out there that explain what exactly a minimal complete example is, and how and why to create them?

like image 985
Brooks Moses Avatar asked Oct 30 '10 07:10

Brooks Moses


People also ask

What are the 5 levels of severity?

Severity is of 5 types: Critical, Major, Moderate, Minor, and Cosmetic.

How do you write a good bug report tips and tricks?

Tips and tricksAvoid duplicates → Always try to search your current issue tracker for existing reports. Reproduce the bug before creating the bug report → This makes it more likely that the developer will be able to reproduce the problem and identify where it comes from.


2 Answers

It's all in the name. A complete minimal example is an example that is complete and minimal. Complete means that it contains all pertinent information, and minimal means it contains no information that is not pertinent. The ability to identify what is an is not relevant is something that only comes with practice - trying to provide instructions for this seems a little like trying to provide instructions on riding a bicycle. You can give the technical explanation and describe the mechanics (and the TeX FAQ you linked to does that very well) but in the end the only way to really learn is by doing.

like image 167
Benubird Avatar answered Sep 23 '22 15:09

Benubird


I'll start this off with the ones I'm familiar with; these both come out of the TeX community, and so are a little oblique for programming. I'm hoping other people have better answers.

The TeX FAQ has an entry on How to make a “minimum example”.

That page points to a somewhat longer article on "What is a minimal working example?". Again, this is for TeX documents; the ideas are the same, but the tools and details a little different.

Edit (2013/01): Another one that I noticed in a StackOverflow comment: The "Short, Self Contained, Correct (Compilable), Example" page. Not perfect, and it suggests 20kb (!) as an upper limit, but a good addition to the list.

Edit (2013/02): Jon Skeet has a blog post about writing good questions, which includes a section on sample code that seems useful.

like image 25
Brooks Moses Avatar answered Sep 21 '22 15:09

Brooks Moses