10
\$\begingroup\$

In this question, I'm trying to ask about best practices for inner classes in Java, but it got closed because I only posted the code skeleton of the class structure and important methods.

The problem is, this particular class is actually the interface that moves data from my Javascript interpretation class to the API of the game I'm making a plugin for, and is only constructed by another class in response to game events, and posting working code that doesn't use any example code would require posting the bulk of my program, which would be far too much code.

This sort of subject seems to be still under debate of what to do in general. What would make the most sense to me would be constructing substitute versions of the other classes it interacts with, to provide an example of the input and output this program would deal with, but this would be example code, not allowed as far as I can tell. What should I do?

\$\endgroup\$

1 Answer 1

10
\$\begingroup\$

I put a close-vote on your question, because it's not a good fit here. You are asking a whiteboard-style programming question about how you should design your classes. That's something that probably belongs on Programmers (but read through their help center first).

A good indication that you're not actually seeking a code review is that you phrased your question in a “Solution A versus Solution B – which is better” format. This is generally bad on Stack Exchange because such questions have a tendency to be more opinion-based than objective.

If you were asking for a code review, you'd be interested in any and all ways to improve this code, including but not limited to minor design issues. That implies that you would post your actual code, so that we can actually criticize all aspects. A question “Does this concrete code follow best practices, and I'd like reviews to focus on topic X” is OK, but a question “what are the best practices for X” is not. In the context of this site, code reviews are meant to improve your style and through that your programming skill. They are not meant to solve problems.

If you feel that the project is too large to be reviewed, then the normal procedure is to put the important excerpts which you want us to focus on into the question, and provide a link to the rest of the code (e.g. on GitHub) for context.

If you think that we misunderstood your intentions, edit your question to make it on topic. It can then be reopened.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Okay, I think I agree that the original question works better on Programmers (which I hadn't known about before). However, there were a few other things that I think deserve a review, so I think I'll generalize the question and post more code once I get GitHub set up. \$\endgroup\$
    – Vitruvie
    Feb 18, 2014 at 19:12
  • \$\begingroup\$ What about questions like "I tried this first, then I tried this. Which one is better or is there another solution I'm not thinking of?" \$\endgroup\$ Feb 19, 2014 at 19:14
  • \$\begingroup\$ @davidkennedy85 That's a good question. I'm really not sure how that should be handled, but “which implementation is better” would tend to be off topic. You can ask a new meta question about that, if you'd like. \$\endgroup\$
    – amon
    Feb 19, 2014 at 19:52

You must log in to answer this question.

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