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

Possible Duplicate:
Feature allowing SO to execute code snippets in a sandbox and produce useful results

The code we look at and work with on SO is so "dead". Answerer's can scan it over with their eye's, but it's not natural. Answerer's can copy it into an IDE to bring it to life, but this is not effecient.

OP's should be allowed to updload a method that can be executed within a selectable context (E.G a console app). Give the method a common name so it will hook and execute. Imagine template pattern. If one participates in TopCoder its quite similar. OP's should be allowed to specify their own secure template that can't be seen by answerers. This should be a special case as it requires some knowledge and coding to implement. Second, custom template upload is a special case because people should learn to reduce the problem down to a simple compileable example first. Answerer's should be able to modify the method hook and propose it as a unique solution.

This not only allows answerer's to be more effecient and more natural, but it encourages iterative improvement and works the same way that we normally perform our daily development tasks. A debugger will print error messages.

I'm speaking in terms of .NET, but this could apply to other frameworks/languages.

share|improve this question

marked as duplicate by dmckee, Robert Cartaino Dec 31 '10 at 0:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

-1's no comment. lol jump on the downvote boat. I have seen no one offer me a reasonable explanation for why this would not improve quality. –  P.Brian.Mackey Dec 31 '10 at 0:15
Duplicate: Feature allowing SO to execute code snippets in a sandbox and produce useful results. I knew I'd seen this before. –  dmckee Dec 31 '10 at 0:19
@P.Brian downvotes have a different meaning on Meta; here, they are simply a sign of disagreement. –  Pëkka Dec 31 '10 at 1:27
I think the author means he'd like the equivalent of jsfiddle for other languages as well. –  wildpeaks Dec 31 '10 at 1:39
@Pekka Don't downvotes mean disagreement on the other SE sites as well ? –  wildpeaks Dec 31 '10 at 1:39
@user the distinction here is "I disagree with this suggestions" as opposed to "this question is ill-posed or unhelpful". Downvoter's here may think that it is a good topic to discuss and well stated and simply want the suggested change to not happen. –  dmckee Dec 31 '10 at 3:53
add comment

4 Answers 4

up vote 7 down vote accepted

99% of the code snippets I see on SO aren't executable, and therefore this wouldn't work in any case. If you need something like this, that's what codepad.org is for.

share|improve this answer
That's a false conclusion based on partial information. The fact that the code is "dead" to start with encourages posting partial and/or syntactically incorrect code. I don't buy that people can't post code that compiles nor that it won't improve quality. Also, it's the answerer's job to fix the code not the poster's so its irrelavent. –  P.Brian.Mackey Dec 30 '10 at 23:52
That comment is utter nonsense. Breathing life into code is a programmer's first and foremost job. Answerers don't have a job, they have a hobby. You got the job, you are getting paid to do it. –  Uphill Luge Dec 31 '10 at 0:30
I always hate how codepad compiles code by default, since most of my snippets don't compile. (Besides that it's an amazing website) –  Andreas Bonini Dec 31 '10 at 1:00
+1 for codepad. That's awesome! –  John Jan 2 '11 at 3:39
add comment

I don't think this is possible at all. Creating execution environments for dozens of platforms and languages would be a huge technical effort - enough to keep a good team busy for a year. And it would add security issues and complications galore, both on the server and on the client side.

This is a job for individual third party sites that provide "workbenches" for code snippets. JSFiddle already does that job very nicely in the HTML / JS / CSS tags.

share|improve this answer
I realize there will be security concerns, but if we could dismiss improvement on the basis on technical issues we'd all be out of a job. Second, there's already a precedent. TopCoder implements a similar model already. Just off the top of my head I can imagine this being run within the context of a VM. Some colleges let people do whatever they want to a computer, but upon logoff everything is reset back to an image. –  P.Brian.Mackey Dec 30 '10 at 23:56
@P.Brian Don't get me wrong: This would be a great thing to have, no doubt, and it would be a worthy task for a good team. But I don't think you are fully appreciating the mind-boggling complexity this would entail, and the vast amount of resources it would bind. –  Pëkka Dec 30 '10 at 23:59
@P.Brian re your update true, this could surely be done in the context of a VM, but don't forget SO has 4.5 million visitors a month (or something like that). You would have to be able to serve them all, 24 hours a day. The infrastructure necessary for that is going to be expensive. This really is a job for individual services offering the functionality for one specific platform I think –  Pëkka Dec 31 '10 at 0:08
@Pekka I do realize this is a big change, but its not impossible. Even with 4.5 million hits/month certainly only a small % are actually posting questions at any given point in time. Sure, there will be more active answerer's as people will find the site more useful. Of course its mind boggling to fully support 100% of languages and platforms at once. We shouldn't negate the possibility of incremental updates. Support C# .NET 3.5, then C++, etc...this is what I had in mind to start with. –  P.Brian.Mackey Dec 31 '10 at 0:08
@P.Brian as said, it would be nice, but I can't see this being implemented by SO. As an idea for a start-up or a Open Source project, it would be lovely though –  Pëkka Dec 31 '10 at 0:14
@Pekka ideone.com already does the job, although it might not scale to SO's usage levels. –  marcog Dec 31 '10 at 0:42
add comment

Although if this was possible it would be handy, but rarely used. The problem with many questions is that when the poster includes code it is either too much, too little, not compilable, or not the actual code they are having the problem with. In the small percentage of the time that code include is good and short, the problem can be identified with just reading it.

Secondly identifying the cause of the problem is really just a preliminary step in the direction of the root question of why does x work this way? or why should I not do x?

share|improve this answer
add comment
  • Have you read the kind of code that gets posted most of the time? Do you really want to see enough more of it to actually get it to do something?

  • Have you taken note of the number of different platforms that are represented? How many do you think can be supported?

  • Do you really want to hand every coder on the internet another way to run code on your box?

and finally

  • Do you really want to make it easier for our average poster to get along without ever learning anything about debugging?
share|improve this answer
add comment

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