Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I'm teaching myself Java, and it's (effectively) my first programming language. Sometimes when I complete an exercise I wonder if I've done things in the right way.

For example, perhaps I write a little program that successfully copies a file. Have I dealt appropriately with the things that can go wrong? Is my code unusual or hard to read? Is there a more standard way to accomplish the goals of this program?

So I'm wondering if posting such code with a request for general feedback is appropriate. My hesitation is that it can lead to discussion, rather than a definitive answer, and it could seem to be undesirable clutter. Nevertheless, such questions (unlike the meta-question that I'm asking now) would be programming questions, and there are many objective answers that could be offered.

So let me know. Is this good use of Stack Overflow? Or acceptable as Community Wiki? Or should I find a friend to review my code, and use Stack Overflow for clearly defined, objective questions?

share|improve this question

migrated from Feb 18 '11 at 21:18

This question came from our site for professional and enthusiast programmers.

This kind of meta-questions is broadly discouraged. No, there is not a good place to ask it. Ans: It depends, but I lean against it. YMMV, etc. – dmckee Apr 7 '09 at 12:37
Good question, but belongs on uservoice, or should be expanded to become part of the SO FAQ. Questions like this come up all the time . . . – Binary Worrier Apr 7 '09 at 12:40
Sorry. Now I know about uservoice. – Eric Wilson Apr 7 '09 at 12:52
I think this question was more general than just "Is it okay to ask this question on SO?" and my answer was in the same vein. Shall vote to reopen if closed. – Cerebrus Apr 7 '09 at 12:56 – badp Feb 18 '11 at 21:30
somewhat hilarious that this question is migrated after nearly two years. Voting to delete, hard to believe that this question adds value. – Eric Wilson Feb 19 '11 at 3:32

Don't ask for general comments - identify a specific bit of the code you are concerned about and ask a specific question about that bit of code.

share|improve this answer

I think that every budding programmer faces this question sometime... "Am I writing good code?" The major problem with finding an answer to that is that the answer can be straightforward or sometimes it may be as complex as being able to decide between multiple opinions offered (as you yourself mentioned).

The way I answered this question for myself was to do my research... search the web for similar topics and study the code posted by people on blogs, articles, forum discussions and then make my own decision as where my code stands in comparison. It helps a lot that there is a wealth of technical information already available on almost every conceivable topic, ranging from simple tasks that most new programmers face to complex tasks. This research also helped me learn that there are about 10 different ways of accomplishing any programming objective and each of those ways is best suited for a particular scenario (one may be most performant, another most secure, and one just plain deprecated).

I would discourage asking every "homework" question on this or any other forum, whenever you are faced with doubts. If you must, then ask after you have done your research so that you are already better equipped to choose the best answer.

share|improve this answer

It's fine to ask homework questions here. Generally it's best to tag them with the "homework" tag if for no other reason than it tells potential answerers that you (probably) are learning and that we should probably give you advice and points to consider rather than definite answers.

It's also fine to post code as long as you're asking a relatively specific question and so long as the code isn't relatively brief (reduce it to a meaningful snippet).

share|improve this answer

It's OK to write bad code while you're still learning. I don't think most people can learn the basics at the same time as learning about efficiency, code clarity, and the dozens of other things professional programmers should consider.

Community review of your code could be a valuable teaching tool, but in the first few years learning how to figure stuff out for yourself may be even more valuable.

If you focus on writing code in a professional style you won't be focusing your energy on learning the fundamentals.

share|improve this answer

You must log in to answer this question.

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