Since I'm bored and want to procrastinate I wrote you a not so handy step-by-step guide on how to be more respectful and assistive. Be warned, I turned your question into a different direction...
- Remember that Stack Overflow is a question and answer site for professional and enthusiast programmers.
It's not a forum, it's not a free version of guru.com, it's not a support hotline. And it might sound harsh, but we are not a training center, we can't really teach you how to become a professional programmer. But we can help you to get there. But we need your help. So let's continue...
- Analyze the problem. Try to think like a professional or enthusiast programmer
- break the problem down into smaller units
- debug the problem, inspect variables, step through code, comment out code, experiment with your problem. Does it still exist if you do x, y or z? Write those attempts down.
- if something stopped working and you think you didn't change anything, look at the diff in your version control system (yes, even if you don't work on a team you should use one, commit often)
- comment out as much code as possible so you have an example that shows the problem with the smallest amount of code possible
- do this for a prolonged amount of time. if you spent less than 15 minutes to figure out a solution yourself there is a good chance that you are unable to write a good question
- Research the problem with the help of Google and Stack Overflow
- even if you won't find a solution that exactly fits your problem, think about the stuff that you've just read. Can it be applied to your situation? Learn to become an analytic person.
Depending on your problem it might be better to do step 3 before step 2. If your problem produces any output (e.g. error message, an exception) put as much of it into Google.
Still no solution? Time to ask a question on Stack Overflow
- If you haven't done already, take the Tour before asking your question
- So it's finally time to write down your question.
- Think about a good subject. It should be clear and should tell the reader what your question is about. "My code does not work" is not a good subject. Can't think of a good one? Leave it empty for now and come back when you are done writing the body
- Describe the problem
- Tell us what you expect and what did not work. Did you try different solutions? Tell us about them ("I tried different things") is not good enough
- if there are any error messages, copy and paste these message into the question. If your problem is a crash or an exception that comes with a stack trace, post that as well. Don't use screenshots for these, there is usually a way to get them as plain text from your IDE.
- post your code, in writing. Don't use screenshots. We want to copy and paste it to play with your code
- it should compile with minimum work. If you use a bazillion variables in your code it's nice if you mock them for us so we just have to copy and paste. But mention if you do this
- use proper formatting
- omit method stubs that don't do anything
- Remove unnecessary whitespace
- remove unnecessary comments that come from the IDE template
- You can use inline comments to show us where problems have occurred. But please use the proper comment syntax for that language (e.g. prefix them with
//
). Remember we want to copy and paste to try your code
- now is the time to tell us about some of the variables. What values do they have? If your JSON decoder does not work show us the JSON source. You can remove confidential parts. But the values (and the code) you post here should actually reproduce the problem. We don't like to spent time on a question that is unsolvable because the redacted code works. Double check if the problem still exist with the version you post here. Basically you should really try to make it easy for people to reproduce the problem.
- If you think your code is correct but it behaves weird it might be a good idea to mention the compiler (or the IDE if you don't know the compiler version) and the operating system you are using. Maybe your problem is related to one of these.
- Think about good tags for your question. There is no need to use all five tags. If your question is code that does not compile it's usually okay to just tag the question with the language. No need to sweat it, it's easy to use to fix tags. But we want to avoid it, so help us.
- Don't hit submit yet.
- Reread the preview of your question. Does it look okay? Is the code formatted correctly? Is there anything missing? For bonus points get a glass of water and reread it again.
- Hit submit. And wait.
I know it's an elitist approach. I know nobody wants to spend so much time and effort. I know that's a lot to ask for. Especially if you are a beginner.
But that's not a problem, these steps are not the law, it's just what I do nearly every single day. If I have a problem (which happens quite a lot) I turn to Stack Overflow for help. But I don't start with asking a question. Stack Overflow already has answers to most of the questions that are asked these days. That's great, but you have to find them.
Enough bragging about how awesome I am. I think even beginners should be able to follow these steps. If you can't perform a step, skip it and continue with the next one. Once you've asked your question go back to the steps you skipped and see if you can do something to perform them the next time.
All of these steps are huge timesavers. If you know how to solve a problem yourself you don't have to wait for Stack Overflow to answer your question.
And I know I put the main burden on the men and women who ask questions, but that's my point. If you make life easier for people that answer questions, you will get less downvotes, less harsh comments, and more important faster and better answers.
We like to answer questions, we like to help, that's why we are here. The problem is these days there are so many question. Especially in high traffic tags too many not-so-bad questions stay without answers because we can't find these questions. They are just hidden between bad, easy to answer and already answered questions that are blocking our view.