What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

My ability to answer questions on Stack Overflow is mostly because I've answered questions without actually testing them out (in the case of PHP and other programming languages that aren't Javascript). By the time I can test anything else, it seems like the question is already answered.

Is it normal for people to actually setup an environment specifically for sandboxing Stack Overflow questions?

share|improve this question

migrated from programmers.stackexchange.com Jun 8 '11 at 14:39

This question came from our site for professional programmers interested in conceptual questions about software development.

4  
You could try ideone. I see it referenced in SO answers from time to time. –  user7116 Jun 8 '11 at 14:48
7  
I, as a Turing complete machine, execute my examples in my head prior to submission. However, I use it for other things as well, so I can't say I have a specific sandbox environment for them. Fortunately, due to my rigorous security standards, I have no yet been infected with any viruses via stack overflow. –  Adam Davis Jun 8 '11 at 14:55
    
Man, I must be doing this wrong. I should just trust my brain compiler. –  Nic Jun 8 '11 at 14:57
    
@sixlettervariables I see that used too. I think I'll try it throughout the day and see how it works. Going back on this question, I noticed that a lot of the questions I answer aren't originally the clearest they could be initially so it leads to a lot of edits anyway. –  Nic Jun 8 '11 at 15:02
    
Yup, I just wing it. That's what comments are for, to tell me if my code doesn't actually compile. The important stuff is right. –  Cody Gray Jun 8 '11 at 16:15

9 Answers 9

LINQPad is a good go-to tool for quickly verifying .NET answers or to debug questions. Some of my answers go through there first, some through the full VS IDE, and quite a number just get entered directly into the input box. There's no hard-and-fast approach.

share|improve this answer

My environment for writing code for C++ and C answers is bash, vim and the g++ compiler. You don't need an IDE for the small amounts of code most SO answers require. I do use a dedicated SO directory, if that counts as an environment.

share|improve this answer

Try to use only the answer box and your brain: make mistakes, edit your answers! You'll become a much better programmer in the end.

share|improve this answer
    
I don't agree with this. Yes, you will become a better programmer, but Stackoverflow isn't fundamentally an exercise to make you a better programmer -- it's about providing a resource for the programming community. –  lonesomeday Jun 8 '11 at 16:09
    
@lonesome: My point is he shouldn't shy away from submitting an answer because he doesn't have 100% code coverage from unit tests for his answer. Besides, the question asker is going to be the ultimate arbiter of "passes my tests". Granted if the user is going to use SO as a personal compiler they're going to get downvotes (and probably should). –  user7116 Jun 8 '11 at 16:14
    
But I hate being wrong! :P –  Nic Jun 8 '11 at 16:41

My environment for answering SO Questions is Notepad ++.

share|improve this answer
    
Yes, I'm sure a lot of people use an IDE at some point when helping out. That wasn't really my inquiry. –  Nic Jun 8 '11 at 14:42
2  
@melee That is what I use, that is my environment, what is your question then? –  Marcelo Jun 8 '11 at 14:45
2  
I use the answer box and my brain. I make the same mistakes there that I would in an IDE. –  user7116 Jun 8 '11 at 14:47
    
my apologies, you're right, you did answer the question - I think for some types of questions, there's a lot more than an IDE to take into consideration. I'd imagine some people have Apache setups for webdev questions or possibly a blank template for C or C# questions. Things to actually test more complex issues with tons of context. –  Nic Jun 8 '11 at 14:53
1  
@melee That is right, it really depends on the kind of topics that you focus on when answering. –  Marcelo Jun 8 '11 at 15:00

For python answers I usually run a quick test in ipython unless there's a lot of setup, then I just run it in my head.

share|improve this answer

I have a project in Eclipse dedicated to testing pieces of code. I use that for things like running a section of code from a SO question.

share|improve this answer
    
Does it help you answer with a higher quality and faster? –  Nic Jun 8 '11 at 14:55
    
Yes, because I can run code to test for an answer, or I can run code from the question and see a full stack trace or something else the OP might have left out. –  jzd Jun 8 '11 at 14:57

Yes. A few.

I have an Eclipse workspace for Java questions

I have a Visual Studio scratch solution for C# questions

The other tags I dabble in are python and SQL and such where you don't really need to have a full project/build setup ready to go.

share|improve this answer

Most of my answers are PHP and Javascript, and I have an Apache virtual host set up specifically for StackOverflow testing -- it's cleaner than doing it on any of the other virtual hosts I have set up.

Originally it was so.localhost, but I've changed it to test.localhost because I wanted to be able to press ctrl+l, s, return to go to the main StackOverflow site and my browser often decided I wanted to go to so.localhost instead.

share|improve this answer

It really depends on the questions: a lot of questions rely on knowledge of how a language is supposed to behave (something you can get from documentation), and others depend on ability to find bugs (something you can do by inspection), both of these things don't require actually running code.

For questions that do require running code, ideone.com is nice because it covers a lot of programming languages, and you can use it fairly quickly without setting up anything more than the minimal required example.

It's also nice to do a correctness check on ideone when you do post code in your answer, but you can always post your answer first and debug it later.

share|improve this answer

You must log in to answer this question.

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