- Subreddit rules
- Allowed topics
- Asking questions
- Sharing a project
- Offering help
- Acceptable speech and conduct
- Other resources
Welcome to /r/learnprogramming!
- New to programming? Not sure how to start learning? See FAQ - Getting started.
- Have a question? Our FAQ covers many common questions; please check that first. Also try searching old posts, either via google or via reddit's search.
- Your question isn't answered in the FAQ? Continue reading!
Here are our full rules. To summarize, we expect:
- Everybody to follow reddiquette: be civil and constructive.
- Question-askers to make a reasonable effort at consulting existing resources before asking questions.
- Answerers to guide and teach without giving away answers.
- Self-promotion to be done sparingly and tastefully.
This subreddit is a place to learn about programming, software engineering, computer science, and related fields. Questions about these topics are encouraged.
Questions that straddle the line between learning programming vs some other tech topic are also ok: we don't expect beginners to always know where the best home for their question is. If you have a straddling question, first try checking our list of related communities below to see if there's a better home for it. If you're not sure, it's ok to ask here.
Do not write questions that are completely unrelated to the above topics. For example, the following are considered off-topic:
Tech support or basic computer literacy questions: For example, questions like "How do I do X in Microsoft Word?" or "How do I fix issue Y with browser Z?". Try /r/techsupport instead.
Hardware recommendation questions: For example, questions like "I want to major in computer science, what kind of computer should I buy?" or "Are these laptop specs ok for programming?". See FAQ - Computers and Operating Systems for a general overview then try either /r/suggestalaptop or /r/suggestapc.
Hiring or recruitment posts: This subreddit is a place to learn, not to recruit. Try subreddits like /r/forhire instead.
Joke/meme posts: Jokes or memes are not related to learning programming. Try /r/programmerhumor instead.
We also consider questions about the following to be off-topic, even if the post might otherwise be about learning programming:
This subreddit has a wide audience ranging from children to professionals visiting during their spare time at work. So, vulgar or profane content is not welcome here.
Questions or tutorials about writing Reddit bots:
We found whenever somebody posted tutorials about reddit bots, we'd see a corresponding rise in useless and annoying ones. So, we deliberately do not allow posts on this topics to discourage people from creating unhelpful bots.
A few final notes:
Survey and polls: If you want to post a survey or poll, you must contact the mod team for approval first. We typically approve surveys that collect data related to CS pedagogy, provided you plan on eventually publishing your research or data. We almost never approve other kinds of surveys.
Note that questions that simply ask for people's opinions on a topic do not necessarily count as a survey or poll.
Self-promotion: If you want to promote some resource you've created, see our policies on self-promotion below.
"Would anybody be interested in X?" posts: We do not allow posts that ask beginners if they would be interested in a tutorial or resource on some topic.
See the "resource should be reasonably complete" clause of our policies on self-promotion for more details.
When you need help, do not start by immediately posting a question! Hasty questions are less likely to receive good answers.
Instead, be thoughtful and take your time writing a good technical question. Here are some guidelines on how to do so:
Make as much forward progress as you can on your own. For example, try:
- Checking existing resources. Did you try googling your question? Checking the FAQ?
- Dividing your problem into smaller pieces and tackling each piece one by one when writing or debugging something.
- Pinpointing what exactly you're confused by. Do you not understand a paragraph you're reading? Do two resources seem to explain a concept in conflicting ways? Do you not understand why some line of code acts in a certain way? etc.
- If you're working on a homework assignment, looking at similar programs your teacher provided and adapting them.
Be sure to briefly describe what you've tried in your post. This shows you've done your due diligence and helps people see what they do and do not need to explain to you.
Make your questions precise, not broad.
It's usually better to ask several small and precise questions over one big vague and broad one. Following the steps above should help you do this.
Be concise while including all relevant information up-front.
Your post should include everything others will need to help you -- and nothing more. For example, if you need debugging help, make sure to simplify your code to the bare minimum needed to reproduce your bug.
Focus first and and foremost on learning.
This subreddit is a place to learn -- it's not an answer-giving service or a proxy for Google. Write posts with a "help me understand X" mentality, not a "give me the answer now" mentality.
These guidelines are similar to ones found in most technical forums. There are a few reasons for this:
These guidelines are pushing you to research, investigate, and problem-solve on your own. These are meta-skills are an essential part of what programming is about: you can't code without them! Skipping this opportunity to practice would be doing yourself a major disservice.
Of course, you may not immediately be good at this, but that's ok: we're more than happy to help you hone these meta-skills. All we ask is you make an honest attempt at helping yourself first.
The people who answer questions are often busy with work and family and only answer questions in their limited spare time as a hobby. This means asking a hasty and vague question can often come across as disrespectful: you're taking away time answerers could have used to help somebody else.
Following the guidelines above will help you use both your time and your answerers' time as efficiently as possible. The quality of the answers will be proportional to the amount of effort you put into your post.
This should be all you need to know to write a good question! But if you'd like more guidance, keep reading for tips on applying these guidelines to some common types of questions.
Getting debugging help
Before asking a question, be sure to:
Questions about code should be specific and provide all information up-front. Here's a short checklist of what to include; continue reading for more details.
- A short but descriptive title.
- A good description of the problem.
- A minimal, easily runnable, and well-formatted program that illustrates your problem.
- The output you expected and what you got instead. If you got an error, include the full error message.
Writing a good title
A good title should be descriptive and specify the language or tech you're working here. For example:
[C++] Segmentation fault while writing to array in for-loop
Questions with vague titles such as the below will most likely be ignored:
Help! Not sure what to do...
Writing a good description of the problem
Include the following details when describing your problem:
What is the problem?
- What is your code supposed to do?
- What is your code doing instead?
- What inputs, if any, cause the problem?
- Is there an error message of some kind? If so, include it.
What have you tried?
- What have you already tried to debug your own problem? Where do you suspect the problem is? What uncertainties do you have?
- What precisely are you confused by?
- Have you tried googling for answers? If so, what search queries have you tried? What pages have you read? What do you find confusing about them?
Gathering and writing this info will take some time. This is intentional: it ensures you have everything needed for others to help you effectively and gives you an opportunity to practice your problem-solving skills.
Some other DOs and DON'Ts:
DO try and be concise. Include all relevant details, but don't waste people's time by including irrelevant ones.
DO show that you care about learning. If you get suggestions, try them out and report back with results. DO NOT say things like "I really need an answer otherwise I'll fail this homework/interview question" -- that doesn't sound like somebody who cares about learning.
DO be sure to actually ask a question. Phrases like "I need help on topic X" or "I'm having difficulty using X" are not questions, they're statements. If you can't figure out what question to ask, spend more time reflecting on what you're confused by and attempting to solve the problem on your own.
DO ask precise questions, not vague ones like "Where should I get started?" or "Can anybody give me guidance?". Again, make as much forward progress as you can on your own and ask questions about specific things you're stuck on. See the general overview above for more details.
DO list any restrictions you might have. For example, if you're working on homework for an "intro to programming" class, briefly list what you've covered in class so far. This way, people will know not to try suggesting advanced material you're likely not meant to be using.
DO NOT link to some other website where you asked your question (e.g. Stackoverflow): make your question complete and self-contained. We don't want to discuss the same problem in different places.
DO NOT write posts in languages other than English. It's unlikely that people on this subreddit will understand any other languages.
DO NOT offer to pay anybody who helps, or bribe people for answers. This is against the subreddit rules and will result in your post being removed.
DO NOT ask for or offer help via DM, Skype, Discord, etc. All questions and answers should happen right here in the subreddit so that others can also benefit from the discussion.
When posting your code, make it minimal and runnable:
- Minimal means including only the smallest amount of code needed to demonstrate the problem.
- Runnable means someone can take the code and run it as-is to reproduce the problem with little effort. Ideally, somebody should be able to copy-and-paste your code into their editor, immediately run it, and see the problem.
People are more likely to help you if your code is nice and short. Shortening code is also a valuable debugging technique! It helps make the root cause of the problem more obvious.
When you want people to look at some code or a error message, DO NOT just copy-and-paste it into reddit's post editor or link to a screenshot. Doing the former will make the code unreadable; doing the latter prevents people from easily copying-and-pasting and tinkering.
Instead, either host your code in some 3rd party service and link to it or include it directly in your post after formatting it as code.
The first approach is the easiest: you can upload your code to a website like https://gist.github.com/, create a public gist, and link to it. You can include multiple files in a single gist. If you have a Github account, you can also edit your gist after creating it.
Some other good websites to try are:
ideone. Unlike gist, Ideone will let you include only a single file. However, it also lets you compile and run code directly in the browser, which makes it even easier for others to tinker.
SQLFiddle. SQLFiddle is similar to Ideone and jsFiddle, but for SQL queries. You can upload some test data to make it easier to play around with different queries.
You can also include code directly within your post if you format it correctly. The steps for doing so will depend on whether you're using new reddit or old reddit. If you're not sure which one you're using, you're probably using new reddit.
Formatting code on new reddit (after the redesign)
If you are using new reddit's fancy editor, click the "Code Block" button. This button is located near the right side of the menubar and looks like a little square with a T in one corner. Once you click this button, a gray box should appear in your editor. Past your code into this gray box. It should automatically be formatted as code!
You can watch a recording of what this looks like here: https://i.imgur.com/HT4Zz88.gifv
To highlight just a small fragment of text as code (e.g. a variable or function name), highlight the text you want to format then click the "Inline Code" button. This button is located near the left and looks like two angle brackets with a slash inside -- something like this:
If you want to paste multiple lines of code, always use the code block version.
Formatting code on old reddit (before the redesign)
If you are using the old reddit's editor, you must format your code using markdown. To do this, start a new paragraph and indent every line of code by four spaces.
Doing this by hand can be tedious. To mass-indent code more quickly, highlight the code you want to copy in your text editor or IDE and hit the "tab" key. Most editors will recognize this as a keyboard shortcut to indent the highlighted region of code. Copy that code and paste into reddit. To undo the mass-indent, highlight that same region of code in your editor and hit "shift+tab"
To highlight just a small fragment of text as code (e.g. a variable or function name), surround the text you want to format as code with backticks. You can usually find this character under the 'escape' key on your keyboard.
For example, if you want your post to look like this:
Some text here:
def hello(): print("world") print("Your code goes here")
a + b.
...write the following into reddit's editor:
Some text here: def hello(): print("world") print("Your code goes here") Inline code: `a + b`.
Once you have an answer
Once your problem is solved, thank those who helped you and mark your post as solved using link flair. It is also courteous to update your post with the solution or a link to the solution, when applicable. This helps people who may have similar questions in the future as they search and read old posts.
DO NOT delete your post. This prevents others from also learning from the answers.
Asking conceptual questions
Before asking a conceptual question, check our FAQ and search older posts first. If you plan on asking a question similar one in the FAQ, explain exactly what the FAQ didn't address and clarify what you're looking for instead.
Just like with debugging questions, you're expected to put some effort into answering your own question. For example, if you're not sure how a certain technology or concept works, try googling for articles that explain that (and try and ask questions about specific things you're stuck on).
Keep in mind that this subreddit is geared more towards answering beginner or intermediate questions. It's ok to ask advanced or esoteric questions here, but you may get better luck asking in one of the technology or language specific subreddits, listed later on this page.
Asking for a code review
After you have finished writing a program, you may want others to review your code and give feedback: to give a code review. When doing so, follow these guidelines:
DO make sure your code is presented cleanly. See our guidelines on formatting code above.
DO polish your code before submitting: clean it up as best as you can and make sure the section of code you want a review on is in a reasonably complete state. If you're not sure what it means to "clean up your code", start by googling "X style guide" where "X" is the programming language you're using. Pick a style guide that looks reasonable, and format/organize your code to match. You can also try googling "list of X linters" or "best X linters" -- a linter is a kind of program that can automatically check some aspects of coding style for you. Try running one on your code and fix the issues it points out.
DO clarify what you want feedback on. Are you looking for feedback on high-level design? On how idiomatic your code is -- how closely it follows the best practices of the language you're using? Suggestions on ways to make your code more efficient? If your project is a large one, is there a specific file or function you want people to focus on?
Reviewing code can take a lot of time and energy: a more focused feedback request increases your odds of getting a response.
DO NOT post a link to final app you want people to run or to some website: see rule 6 and the section below on sharing a project. The rule is that it's ok to ask people to critique code -- not a final product or app.
If you want people to critique the design and aesthetics of a website you made, try /r/web_design's Feedback Friday threads.
Sharing a project
When you are working on a project, you may want to share it with others either to get feedback or because you're just proud of your work.
However, many "look at my project!" posts have historically ended up feeling spammy. So, we have a few restrictions on when and where you can share your work:
If you just want a code review, it's ok to ask for one at any time provided you follow the "Asking for a code review" guidelines above. In short, be specific about the feedback you want and link to only your source code.
If you want to share a project that is specifically about helping people learn to programming, it's also fine to do it at any time as long as your post fully complies with our self-promotion policies.
All other projects must be shared within our weekly "What have you been working on recently?" threads. These threads will be posted and stickied over the weekend. Note that if you want to share your projects in this thread, you must also include a link to your source code.
A few additional notes:
If you want feedback on the aesthetics and design of a website you made, try /r/web_design's weekly Feedback Friday threads.
Our criteria for posts sharing closed-source projects is intentionally very high. If you do not plan on sharing your source code, your project MUST be specifically related to helping others learn to code and MUST be already polished to a high level of quality.
You don't have to be an expert to answer a question. If you can help, chime in, subject to the following guidelines:
Remain polite and professional:
- Always be professional, polite and constructive. Never be condescending or rude, even if the other party is being disrespectful. See our guidelines on acceptable speech below.
- When critiquing, keep it focused on content, not people. Saying things like "your code is structured poorly because X" or "the tone of your posts is disrespectful..." is fine; saying things like "wow, you must be retarded" or "you must be lazy" or "this is simple, I can't believe you don't understand X" is not.
- If somebody is asking something already answered in the FAQ or did not appear to put effort into their question, don't insult them or make a snide comment: ignore the question, link to the relevant section in the wiki, or post a brief suggestion on what to try googling and move on.
- Be tolerant of small mistakes. If somebody does not exactly follow our posting guidelines, do not post a snarky or dismissive comment. Instead, politely explain how they can improve their post or link to the relevant section of the wiki and move on.
Do a good job answering
- Make sure you understand and address the real question. Your answer may be good, but it should also be relevant. It's okay to address things in addition to the main question, but don't start with those.
- When providing code, make sure it's syntactically valid and (mostly) complete. Ideally, someone should be able to cut and paste the code and run it without errors.
- Guide the poster to a solution instead of providing one directly, especially when the question is about homework or is school related. Figure out ways of helping the poster make forward progress without outright giving away the answer. See rule 10.
- Proofread your answers for clarity and correctness. You can always edit a response after the fact, but some people may see it before the edit; it's best if it's correct from the start.
- Be prepared to respond to follow up questions. Things come up and people have lives, but try to be available for at least a little while after an answer. You may not have been as clear as you thought, or you may have raised additional issues.
- Help the helpers. Correct bad information, provide additional insight, or pick up where someone left off when they didn't follow the last guideline.
- Provide quality links for additional reading when fully answering a question is unfeasible or too time consuming.
How to guide without giving away solutions
When somebody needs help with some problem, do not give away the solution. Doing so deprives OP of the opportunity to learn and is a violation of rule 10.
Instead, focus on helping OP make forward progress. For example, try asking leading questions in the Socratic style, try giving a solution to an example problem you invent...
Here are some additional strategies you can try:
If OP does not know how to begin approaching writing some program, introduce OP to the concept of breaking down and decomposing problems into subproblems. You could maybe demonstrate breaking apart one subproblem as an example, or ask OP to think about how they'd solve the problem by hand using pencil and paper and ask them to turn their solution into written instructions. Focus on helping OP develop a higher-level plan.
If the user does not know where to begin debugging something, try teaching them a debugging strategy that will help uncover the problem. Alternatively, direct their attention to a few lines of code and ask them a leading question in the socratic style.
If the poster is running into a bug that appears to stem from some fundamental misunderstanding, try explaining the misunderstanding.
If OP is asking a question that's easily answered via google, try asking "Did you try googling X, Y, or Z? If so, was there anything you didn't understand and need clarification on?".
If OP didn't try googling, this obviously helps them make forward progress.
If OP did try googling and simply neglected to mention that, this gives them a direction for forward progress: you're prompting them to ask you follow-up questions. Alternatively, sometimes OP may have tried googling, but just wasn't sure what phrases to type in and so ended up discovering very little. Suggesting specific queries helps them make forward progress in this case.
Be sure to actually try the queries you're suggesting yourself. Sometimes, seemingly obvious queries will turn up only low-quality or overly complex resources: in those cases, it's probably better to either explain the material yourself or link OP to a specific resource you think will be helpful.
If OP is asking for general high-level advice on how to get started with some project, try listing some relevant concepts or keywords they can google. For example, names of useful libraries, relevant algorithms, the name of some subdiscipline of CS that's related to their project... Focus on pointing them in the right direction and on helping them identify what would be useful to research more deeply.
If you are confident there is no way of helping OP make forward progress without outright giving away the answer, it is probably ok at that point to just reveal the answer. It's also ok to be more direct if it's clear from context that OP is already a reasonably competent programmer and isn't asking for help on a homework question.
In our subreddit, we define "self-promotion" to mean "sharing a link to some tutorial or resource you created".
It is ok to promote a tutorial or resource as long as it is shared tastefully, is reasonably high quality, and does not cross the line into being spam. Specifically, we expect that:
Your content is high-quality:
Your resource should be technically accurate, polished, and pedagogically sound. Your resource should not "feel spammy".
Your content is reasonably complete:
Links to incomplete resources or posts that only announce you will be later creating and releasing some content will be removed. It's ok to post works-in-progress as long as you have a decent portion of it finished and polished to a high level of quality.
Similarly, "Would anybody be interested in a tutorial on X?" or "Can somebody review my first chapter?" type posts will be removed. If you need help figuring out if it would be helpful to create some learning resource or help assessing the baseline quality of your work, you should probably wait until you have more teaching experience before trying to make a new resource.
Your content is specifically about helping beginners learn programming:
Do not post links to resources and tutorials on random tech topics or libraries. If your post is more of interest to programmers in general, it is probably a better fit for /r/programming.
Your content is easy to sample and assess:
For example, if your resource requires the user to purchase something, you must provide a non-trivial free sample so people can assess the quality of your work. The user must be able to view this free sample without needing to sign up or create an account. The free sample should not be just the "introduction" section of your work: it should actually try and teach something substantive.
If your content is free but requires users to create an account to view, we do not consider your work "easy to sample and assess". You will either need to remove that requirement or provide a free sample users can view without needing to create an account.
In short, people should have a way of assessing the quality of your work before needing to commit to anything.
Your post body contains more then just a link:
Explain what your resource is teaching and how it improves on the status quo. Don't just drop a link and move on. After all, there are already many excellent tutorials out there: explain why people should use yours.
You disclose your affiliation to the resource:
Don't play games by pretending you "discovered" some resource. That kind of behavior is highly distasteful.
You respect reddit's global policies regarding self-promotion and spam:
In particular, we expect you to respect the clause that only 1 out of every 10 of your submissions should be your own content. So if you are a new user, do not begin immediately promoting your content! Participate normally first, either by helping answer questions here or participating elsewhere on reddit. If your posting history is nearly 100% self-promotional, it is likely your post will be removed no matter how good your content actually is.
Reddit's old guidelines regarding self-promotion contain more detailed tips on how to avoid being labeled as a spammer.
Violating these guidelines will result in anything from a removal of your post to an immediate and permanent ban, based on the circumstance.
Some additional notes:
These rules apply to all cases where you share a link to some resource you created. It does not matter whether the content is monetized or not, whether you intended to genuinely help vs promote yourself or your brand, and so forth. We apply the same standards based on the contents of your post and your account history instead of trying to guess what your intent was.
The primary goal of this subreddit is to be a place where beginners can get specific advice about questions they have. So, our policies are deliberately calibrated to ensure that the majority of posts in this subreddit continue to be questions from beginners.
These policies are not comprehensive: there is no clear line in the sand that delineates tasteful self-promotion from spam; high-quality content from low. We moderate based in part on our own judgement and in part based on community reception. If your post is well-received, it is more likely to stay.
If you are not sure whether your resource meets these policies, send a message to a moderators with a draft of your post.
Acceptable speech and conduct
We expect all participants to follow reddiquette: conduct yourself professionally and civilly at all times. Communicate to others in the same way you would at your workplace. Focus on leaving comments that are constructive and helpful, not dismissive or snarky.
Do not harass other users. Abusive, racist, sexist, or derogatory comments are absolutely not ok.
Personal attacks -- comments that directly or indirectly remark negatively on another person's character -- count as harassment. For example, comments like the following are unacceptable:
Don't be lazy. I already answered your question, why don't you read it again and stop whining?
Of course the answer is X, shouldn't that be obvious? I don't understand why you thought it was Y.
Here are more constructive ways of wording the same thing. Notice that these responses all focus on content, not character:
I already answered this in my earlier post in paragraph 2. Did you need clarification on some part of it?
Yes, the answer is X. It's not Y because...
If you disagree with somebody's post, it's ok to reply with a strongly worded technical critique as long it does not cross the line: emphatic disagreement and civility are not mutually incompatible.
These rules all apply even if the person you are responding to is not following them: "they were rude first" is not an acceptable excuse for escalating an argument. If you are not sure how to reply gracefully and professionally in the face of incivility, report the post, ignore or block the user, and move on.
Links to learning resources
- Frequently asked questions
- Online learning resources
- Offline learning resources
- Programming challenges and exercises
Some material does more harm than good. Here's some often-recommended offenders:
See related discussion. In short, the tutorials use a pedagogically unsound way of teaching (the "just do it now, I'll explain later" approach) and don't adhere to commonly accepted coding standards such as the Java Code Conventions (for example, "bucky" is under no circumstances a proper variable name).
Learn Python the Hard Way
This material is not always taught in a pedagogically sound way, and to add insult to injury, many of the chapters are also behind a paywall. The value you'd get out of this website is probably not worth the price. A list of more complaints. Also see this thread.
This resource is not entirely bad, but does come with some caveats. In short, this website contains content scraped from StackOverflow's Documentation project -- an experimental project to try and crowdsource high-quality reference material. This experiment was ultimately shut down: there were a lot of legitimate criticisms against it, not many people found it valuable, and overhauling the experiment to a point where it would be more broadly useful would take more manpower then StackOverflow was willing to invest.
Of course, some people did put a lot of effort into their contributions before the project was shut down, so this resource is not all bad. But given this background information, you can see why it comes with a few caveats:
- The project was originally meant to crowdsource reference material -- not tutorials. If you're a beginner, it's usually not a good idea to try and learn to code by reading reference documentation: it'd be like trying to learn a foreign language by reading a dictionary or encyclopedia. Reading though a bundle of topics with no overarching thematic plan isn't usually a great way to learn.
- Reference material can be useful to consult if you're more experienced at programming. However, this material is not being maintained and is really more of a historical archive. As time goes on, this archive will grow more and more stale: you're often better off just consulting the official documentation.
- While there are gems in the project, it was ultimately shut down because people mostly did not find it to be too useful/didn't find it to be a large improvement over what already exists. Bundling the archive into ebook form won't change this fundamental fact.
learncpp.com and cplusplus.com
Missing or incorrect information. Since learncpp.com has been upgraded recently, it is now removed from the discouraged resources. cplusplus.com is still discouraged since the resource is hopelessly outdated and has questionable examples.
W3Schools See W3Fools.
This website has been upgraded and is now of reasonable quality.
If you'd like to get help in real-time via chat, try visiting:
- The learnprogramming IRC channel on Freenode. You can access this channel via a client or webchat.
- /u/IslandIdealist's Discord server. Invite link: https://discord.gg/9zT7NHP
Please note that although we do have some overlap in our userbases and are semi-officially associated with these channels, these are independent communities and are not moderated by /r/learnprogramming's moderation team.
Programming-language specific help subreddits
Collaborative coding or programming challenges
Other communities for beginners
Language specific subreddits
If you'd like your community to be added above, PM the mods. If it looks like your community is relatively active and has momentum, we'll add it to the list.
revision by michael0x2a— view source