How to improve StackOverflow answer post with Java code examples?
Sometimes the sample code is too large. Especially when I added unit tests. And I encourage everyone to post unit tests. There’s so many misleading answers, where a simple test would clearly show the answer doesn’t work.
SO has partnered with Imgur to put attached images there.
Is there something official like Imgur but for code samples?
We still need to put the core part here at SO. No arguments about this. This “Java Fiddle” linked project would be an optional, complementary part of the response.
Requirements:
- Easy to use
- Web based interface
- Free
- Durable
- Support for multiple files
- Ideally interactive, you can run the unit tests
Ideally something interactive, like “Java Fiddle”. But it also needs to support multiple files. I like to post solution Java class file + runnable test. That’s two files. I would like to encourage everyone posting on Java to also post the test.
It also needs to be “durable”, so the link target won’t disappear.
I can create GitHub mini project, just for that one answer. But that’s rather fiddly, too many steps, that would discourage many would be responders. It has to be something with web based interface.
I was thinking GitHub Codespaces.
But it’s more like a browser based full featured IDE. Looks a bit too heavy. Not sure how much it is “free” and “durable” option.
2