What topics can I ask about here?
Code Review Stack Exchange is for sharing code from projects you are working on for peer review. If you are looking for feedback on a specific working piece of code from your project in the following areas...
- Best practices and design pattern usage
- Security issues
- Correctness in unanticipated cases
then you are in the right place!
However, if your question is not about a particular piece of code and instead is a generally applicable question about...
- Best practices in general (that is, it's okay to ask "Does this code follow common best practices?", but not "What is the best practice regarding X?")
- Tools, improving, or conducting code reviews
- How to add a feature to or solve a problem with your code
- Trouble-shooting, debugging, or understanding code snippets
- Higher-level architecture and design of software systems
then your question is off-topic for this site.
What? Questions about code reviews are off topic?
Conducting code reviews is an important skill, much like any other programming discipline. These "whiteboard"-style questions are best asked on Programmers Stack Exchange.
For more help, see "What types of questions should I avoid asking?"
If your question is not specifically on-topic for Code Review Stack Exchange, it may be on topic for another Stack Exchange site. If no site currently exists that will accept your question, you may commit to or propose a new site at Area51, the place where new Stack Exchange communities are democratically created.
I'm confused! What questions are on-topic for this site?
Simply ask yourself the following questions. To be on-topic the answer must be "yes" to all questions:
- Does my question contain embedded code? (a link with the embedded code is still okay)
- Did I write that code myself?
- Is it actual code from a project rather than pseudo-code or example code?
- Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar)
- To the best of my knowledge, does the code work?
- Do I want feedback about any or all facets of the code?
If you answered "yes" to all the above questions, your question is on-topic for Code Review.
Make sure you include your code in your question
This site is for code reviews, which are hard to do when the code is behind a link somewhere out there on the Internet. If you want a code review, you must post the relevant snippets of code in your question. It is fine to post a "see more" link (though, do be careful — very few reviewers will be willing to click through and read thousands of lines of your code), but the most important parts of the code must be placed directly in the question.
Reviewers may comment on any part of the code
Feel free to call attention to specific areas you are concerned about (performance, formatting, etc). However, any aspect of the code posted is fair game for feedback and criticism.
Always keep the original code intact
Stack Exchange places great importance on answers, so we want to make sure they stay relevant with the question. This is why we ask you to please refrain from modifying the original code based on what has been addressed in answers. By modifying the code in such a way, it'll be harder to determine the merit of the answers, as well as easily seeing the original code that was reviewed.
We understand that you'd like future readers to see your new code, and so you have some options to consider after receiving answers:
If you'd like further review, please ask a new follow-up question. You should also specify in the title that it's a follow-up, and post a link to your previous question.
If you'd like no further review, then you may post this code on a 3rd party site and provide the link to it in a comment below the question.
In either case, please do not append the updated code to the question. Otherwise, others may review that, which can skew the review process. If this is done anyway, you will be asked to remove it, otherwise it will be removed for you.
For more information on this policy, please see this post on our Meta site.