I want to know if we can remove unnecessary details from the code or, better said, details that everybody already knows from a question.

Everybody already knows that as a default in a winform app there will be :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

The adding of all this to the code makes the code cumbersome and might even discourage some people (like me) from reading the question.

Now my question is: Can I edit the question and remove all those unnecessary details?

  • @davidsbro Meh, I don't think there's anything in that question that you need to know with respect to this meta post that isn't shown here.
    – Servy
    Commented Sep 27, 2013 at 16:07
  • 14
    I'd actually consider those headers as a necessary part of the SSCCE. So my vote is no, don't remove them.
    – Mysticial
    Commented Sep 27, 2013 at 16:08
  • 7
    Im not familiar with the language but I assume these are import statements, it really irritates me when people omit these because sometimes a single class name could refer to a class from several libraries, without the import ypu don't know which Commented Sep 27, 2013 at 16:11
  • @RichardTingle While such cases are possible, they are rare. You can keep them when they're important and remove them when they're not, rather than always keeping them just in case they are.
    – Servy
    Commented Sep 27, 2013 at 16:11
  • @RichardTingle These imports are always added as default whenever you crate a new project
    – Walker
    Commented Sep 27, 2013 at 16:12
  • @servy I use an IDE so replacing the the imports isnt that easy but on, perhaps 4 occasions Ive put the wrong imports in. And either way it breaks the copy, run, see problem principle Commented Sep 27, 2013 at 16:14
  • 1
    @RichardTingle It's also relevant to consider the type of problem. If it's a compile time error where the error is that a type can't be resolved, the odds of it being relevant is high enough that they should be included. If the program compiles then the odds of the error being a problem with the using statements is very low.
    – Servy
    Commented Sep 27, 2013 at 16:16
  • 3
    @Servy the same could be said for a main method that calls the troublesome method with the right argument, you can usually work it out but I hold it against the OP for not including it and often earns them a downvote under "wasting peoples time by not including a sscce". I'll admit I haven't ever downvoted for missing imports but its certainly a mark against them Commented Sep 27, 2013 at 16:40
  • 1
    @RichardTingle I have almost never seen comments in which people criticized a question for not including the using statements used when the question wasn't directly related to a problem with them, or with the resolution of a given type, nor do I see almost any answers that ever include using statements, or comments criticizing answers for omiting them. In general I see them included in either on rare occasions where figuring out the resolution of a type isn't obvious, and omitted otherwise, and I don't disagree with that practice.
    – Servy
    Commented Sep 27, 2013 at 16:45
  • There is some discussion as to if this question is focused on code edits or more general edits, could you clarify? Commented Sep 27, 2013 at 17:45
  • 1
    @RichardTingle Code edits..
    – Walker
    Commented Sep 27, 2013 at 17:50

2 Answers 2


Using/Import Statements

Courtesy to those answering the question
While using/import statements aren't 100% necessary for a good question, I consider them a courtesy to people prepared to look at my question and help me, and I always include them as part of an SSCCE in my questions. It takes me zero extra seconds to copy and paste them into my question, but everyone who looks at my question must take the time to write them in or select them to be put in with an IDE (managing conflicts as they go).

Clarification of ambiguous functions/classes
Additionally, a using or import statement can clarify which of several identically named functions/classes you really mean, avoiding confusion when people have to guess the using or import. I have myself got 90% of the way to telling someone the methods they were using didn't exist, because I guessed the wrong import.

Questions are for future viewers too
Of course, all the people who are capable of answering the question will know which using or import statements are obvious, but a question isn't just between the OP and the answers. It is also supposed to be a resource for people with the same problem, and we cannot guess at their knowledge. As such, removing imports is to increase the amount of 'assumed knowledge' that the question has. Clearly some assumed knowledge is inevitable, but it's never a good thing to increase it.

Truly Unnecessary Code

Of course truly unnecessary code can go, but if it's necessary for people to be able to copy, paste, run, see problem then it’s not unnecessary, even if "everybody" knows it should go in.

It's worth noting that as a <2k editor even code edits that do just remove truly unnecessary code are likely to be rejected because the reviewers don't have the knowledge and time to check that; that’s a separate issue however.

  • 2
    First off, I'd like to take a second to point out that the question asked is, "Can I edit the question and remove all those unnecessary details?" and not "Are using statements 'unnecessary details'?" I would seriously hope the first question isn't in debate, even if the second is. Next, removing content from a question, particularly code that isn't useful for determining the answer, make it easier to see what the real problem is. Questions that are bloated with tons of unneeded code are much harder to read. In my experiences, fulling half the code region in usings harms readability.
    – Servy
    Commented Sep 27, 2013 at 17:09
  • 2
    The title is that, but the main body uses using statements as the actual unnessissary details. To ignore the main body of the question seems unhelpful Commented Sep 27, 2013 at 17:12
  • 1
    @Servy Clearly truly unnessissary code can go. But I count nessissary as everything to make the code copy, paste, run, see problem and not a line more or less. Of course if you could collapse the imports that would be lovely but thats not the interface we have Commented Sep 27, 2013 at 17:13
  • I didn't say you should ignore it. I am simply saying that you should address the actual question that he's asking in addition to addressing the specific example he gave. The using statements listed were just one example of something that the OP thinks may be "unnecessary details". There are many other options. By all means, address that example, just don't ignore the actual question to do so.
    – Servy
    Commented Sep 27, 2013 at 17:13
  • 1
    @Servy Fair enough Commented Sep 27, 2013 at 17:26
  • Also note the OP isn't specific to code; it says "unnecessary details". I spend a lot of my edits removing unnecessary details. It's not often code (although occasionally it is). Removing unnecessary details in general is something that a huge percentage of posts can benefit from.
    – Servy
    Commented Sep 27, 2013 at 17:29
  • 1
    @Servy While I agree thats true, "I want to know if we can remove unnecessary details or, better said, details that everybody already knows from a question." seems to focus it down more. I agree that you can read it that way but I think PreciousTijesunimi was focusing of code. If PreciousTijesunimi could clarify then that would be excellent Commented Sep 27, 2013 at 17:38

Yes, you can remove unnecessary details from a question, but you should take care to ensure that the details you remove are actually unnecessary. Removing relevant details by accident can be a very bad thing to do.

In my experiences, using statements in a code block are very, very rarely relevant to the question and can generally be removed, although there are occasional exceptions, so be sure you've read through the post entirely to be sure the information really can be removed. (A good example of an exception is if a Timer is used, it's often unclear which timer it is without looking at the using statements being used.)

The good thing here is that whatever you remove will still be in the revision history, so it can still be restored or looked at in the event you made a mistake; it's not information that's permanently lost.

  • Thanks. I also share your point of view. Thats why i didn't add using Sql.Data.Client that is in the question because i believe it is necessary
    – Walker
    Commented Sep 27, 2013 at 16:10

You must log in to answer this question.

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