42

Update

Based on all the comments and on Shepmaster's answer, I think perhaps it would be better to have an MRE Guideline page (that might include templates) instead of a MRE template page for each tag. I really liked How to make a great R reproducible example? but I think it's not the correct way to do it. The Rust tag wiki is more like what I have in mind, only I think that when it's just another part of the wiki it's less usable compared to a designated tag page.

Original question

Based on How to improve a canonical question, that may appear to be “too broad”? on meta, where the OP basically had the idea of posting various MREs, and also on Better support for sample data and perhaps table schemas in SQL questions, where the OP complains about the lack of MREs specifically in SQL questions -

I would like to request adding one more page to the tags - a page dedicated to creating a MRE.

While it's quite impossible to have single question to show users how to write a proper MRE for every known technology, it's actually quite easy to have a single (or even multiple) MRE templates for each tag.

This page should be edited by the community members, just like the tag info page.

For example, an MRE template for might be as simple as

Declare @T as table
(
    -- Columns here
)

INSERT INTO @T (/* Columns Here */) VALUES 
(/* Values here */) 
[,(/* Values here */)...]

While an MRE template for might be something like this:

namespace Mre
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //Your code goes here
        }
    }
}

So here is how I envision it:

links below tag info box with "mcve" link added and circled

It would be more helpful if we could enable directly coping the MRE template to a question on the ask page - perhaps when the user types in the tag, some link in the auto-complete (like the i in the circle is linking to the tag info page).

13
  • 1
    The R tag community sort of did this themselves via an actual SO question.
    – joran
    Commented Apr 23, 2018 at 19:21
  • 1
    @joran Thanks for the link! I know nothing about R, but this is even better then what I imagined. It's kind of like a tag-specific improved How-To-Ask page, which is much more then I bargained for, but of course if that's going to be accepted I'll take it :-) Commented Apr 23, 2018 at 19:29
  • 1
    Well, to be honest, after 6+ years of reading through thousands of R questions on SO, I'm skeptical of how much impact any written "how to write a reproducible example" piece has. I mean, we've been linking to that guide for years and I'm uncertain how often people really read it and are suddenly able to produce a MCVE. But maybe I'm just old and grumpy.
    – joran
    Commented Apr 23, 2018 at 19:32
  • Easy way to achieve what you want: Write a meta question on how to make a good MCVE in language X, link it from tag wiki and/or tag excerpt
    – BDL
    Commented Apr 23, 2018 at 19:34
  • @joran It's a well known fact that the older you get, the grumpier you get. I've only been a part of the SO community for 4+ years so I might be a bit too optimistic, but I find myself repeating the "Sample data is best served as DDL+DML..." way too much. I also noticed I'm not the only one that's complaining about that, so I'm just thinking of a way to make the entire mcve stuff more accessible to new users. Commented Apr 23, 2018 at 19:44
  • 5
    In the C# example, I don't necessarily see the point for including such boilerplate. Not every C# program is structured that way (I use WPF a lot and I have never seen a main loop in it. Nor will class libraries, that cannot be run directly, have a main loop). In the interests of brevity (the M part of MCVE), an example might only include a single function. An example like this might just make new users include more code for absolutely no benefit.
    – Lauraducky
    Commented Apr 24, 2018 at 0:22
  • 1
    @Lauraducky: The C# example is particularly egregious given this post by Shog9 on the subject of MCVEs.
    – BoltClock Mod
    Commented Apr 24, 2018 at 3:05
  • 1
    @Lauraducky While true, you can't run a class library alone, and you can have a specific MCVE template for WPF. And the fact that sometimes a question is about a specific method doesn't make it possible to run that method alone - you still need to call it from somewhere. Pure code questions (not involving UI elements) can be simply pasted into rextester or any other online c# compiler - and that's basically what I'm aiming for - having an MCVE you can copy and paste and you can immediately start solving whatever the problem is, without the need to add any more code. Commented Apr 24, 2018 at 4:13
  • 4
    This page is fine. It isn't rocket science to read it and apply it to the specific language. People who can't take an abstract concept and translate it to source code can't work with programming in the first place.
    – Lundin
    Commented Apr 26, 2018 at 14:02
  • I suspect the vast majority of new users don't read the tag info and certainly won't click through to a mcve link (they won't even understand the acronym). Commented Apr 26, 2018 at 14:05
  • IMO if you want users to use the template, it has to appear when they click "Ask Question", but that is tricky since there is no one template for each question, even within a tag. The current question guidelines are decent if people read them Commented Apr 26, 2018 at 14:05
  • @Chris_Rands I wouldn't say that. The comments are aimed at people who do want to follow community standards, we pretty much don't care about those who don't. So for the people that matters, comments are pretty effective
    – Passer By
    Commented Apr 26, 2018 at 14:07
  • This approach would extend to other sites as well. On Computer Science, if certain tags appear we might want to ask some questions upfront.
    – Raphael
    Commented Apr 27, 2018 at 12:05

4 Answers 4

19

In the Rust tag wiki, we recently added a section aimed at language-specific techniques to reduce the posters original code to create a MRE. See "Producing a Minimal, Reproducible Example (MRE) for Rust code" 1.

I don't know that a "MRE template" is the right solution, but I do think that each language could have a set of steps, general guidelines, or even just hints that could be more specific additions to the existing general guides for creating a MRE.

I'd love it if we got tag-specific MRE pages and if they could be made a first-class part of the tag info so that we could use (something similar to) the short [MRE] links to guide questions in need of a MRE to the most relevant information.

We considered making this information a question like R did instead of putting it on the tag wiki page, but I was dissuaded by other Rust community members as they felt that such a question would ultimately be off-topic for SO.

Having it be a dedicated page would avoid this issue by making an explicitly condoned location for this information.


1 Oh, for the ability to link to section headers...

4
  • 7
    You mean something like [mcve:Rust] or [c#/mcve]? If so, I love this idea. Commented Apr 23, 2018 at 20:47
  • @ZoharPeled I wasn't trying to nail down the exact implementation, but something like that was one idea. Another would be to just have the current [mcve] link to a page that has the tag-specific ideas combined somehow with the generic ideas. I'm sure there's lots of variations.
    – Shepmaster
    Commented Apr 23, 2018 at 21:03
  • Yes, of course, It's just us sitting around throwing ideas to the air hopefully someone will make something out of them :-) Commented Apr 23, 2018 at 21:10
  • "they felt that such a question would ultimately be off-topic for SO" -- I think methods to isolate issues are great topics for SO questions. Those skills are not specific to asking a question here.
    – Raphael
    Commented Apr 27, 2018 at 12:07
12

The whole spirit of asking for an MRE in the first place is to get complete strangers who have no context into the problem the context into the problem in the first place. Providing a template gives them a cookie-cutter approach to use to tick a box, as opposed to actually giving us the context we need.

To that end, I don't think that this is a good idea. We can't support people who don't understand how to debug their code; in that light, we can't realistically create templates for everyone's unique problem or situation.

9
  • 3
    I think you've missed the point of this post - it's only suppose to help new users to understand how mcve works, and perhaps save them some time typing the plumbing code. It's not supposed to provide the entire mcve, just a skeleton so that they could paste their code into. Commented Apr 23, 2018 at 16:39
  • 5
    @ZoharPeled: No, I got that point. It's meant to help rookies who aren't sure how to satsify MCVE. My concern is that this makes it feel like a box gets ticked instead of actually doing what we want, which is give us context into the problem. It's convenient to package what we want as "MCVE". What we're actually after is, "what is the code you're working on and where is it failing?" Templates and cookie-cutter systems don't feel like they get us what we're really after..
    – Makoto
    Commented Apr 23, 2018 at 16:41
  • 3
    Just to make it more confusing - not everything needs a MCVE. Only time one is really "required" is a debugging question. But when you start putting templates into the question, now people start adding MCVE's when none is needed Commented Apr 23, 2018 at 16:52
  • 2
    The context is not always enough. The way I understand it, the point of an mcve is to provide a complete demonstration of the problem - so that who ever wants to answer the question can copy it from the question, paste it into a test environment and run it to reproduce the problem. Commented Apr 23, 2018 at 17:27
  • @psubsee2003 The vast majority of questions on Stackoverflow are code related. True, not even all code related questions needs a mcve, but a lot of them do. Commented Apr 23, 2018 at 17:28
  • 4
    @Zohar Peled: You might be conflating "MCVE" with just about any code sample. "MCVE" is not just a synonym of that. Not every code sample is an MCVE. Each one of those letters stands for something meaningful: Minimal, Complete, and Verifiable. For instance, if you're asking how to do something (i.e. not a debugging question), presumably you haven't managed to do it yet, so how is any code example you provide going to be complete or verifiable?
    – BoltClock Mod
    Commented Apr 24, 2018 at 3:11
  • @BoltClock I'm aware what MCVE stands for, and I'm also aware of the fact that not every question is a debugging question (however, a "how do I do that" question sometimes (especially in sql) requires an MCVE - at least for the sample data part). Of course not every question and not every tag can benefit from an MCVE - Only the languages tags. My point is to make the process of creating a MCVE easier. However, the R wiki post and the Rust tag wiki does seem to be a implementing a better idea. Commented Apr 24, 2018 at 4:08
  • 1
    99% of people asking questions every day have never heard of a step-debugger ( regardless of language ) and 99% of those that do read the autocomment I leave with a link just complain that they want an answer not to learn something new, the majority of the time because they do not have time. I have to agree these one size fits all solutions like templates just reeks of a Documentation-esque over engineered solution looking for a problem.
    – user177800
    Commented Apr 25, 2018 at 1:43
  • Here's an example of a post describing a MCVE for pandas, and another one for R. These are pretty good, and we've found them quite useful. I don't get how providing a link to a MCVE template is spoon-feeding users. Going by this post, you might as well get rid of the [mcve] page, since you should expect users to know to ask a good question anyway.
    – cs95
    Commented May 17, 2018 at 21:24
11

The general idea

Contrary to existing answers - I think it's an excellent idea for some tags.

Such a page in the tag would presumably:

  • Elaborate on Stack Snippets
  • Include expectations of what an MRE for a web problem might use.
  • Include links to what's the expectations of an MRE for common environments (like Node, browsers etc).
  • Include an explanation of how to write good MRE for specific problems:
    • How to write an MRE for questions that only happen on certain browsers.
    • How to write an MRE for questions that appear on certain versions of Node.

I'd also see a lot of potential for the tag and some node related tags.

Cookie cutter responses

I don't think these should be "cookie cutter" though, just provide additional context for the question that relates to the specific technology and using it. Bug trackers have used this technique successfully for a long time now.

1

I don't think this would help much, if at all.

  • Most of the advice for constructing an MRE is tag-agnostic.

There would be a ton of duplication if we create one for every language tag (all of that needs to be written and maintained, which takes time and effort).

A generic MRE page should be sufficient to explain how to construct an MRE in the vast majority of cases. So any given asker who fails to provide an MRE most likely didn't read the MRE help page, ignored the advice or thought their problem was special or the current MRE page requires some improvements or a rewrite.

  • Templates are unlikely to do much.

Saying "insert code here" doesn't stop people from putting code wherever they want, posting too much code, not posting enough code, posting the wrong code or not explaining their problem well enough.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .