Table of Contents
- How to Find Help: The Internet Knows Everything
- How to Handle Error Messages
- Why Programming Language Versions Matter When You Face an Error Message
- When in Doubt, Read the F***ing Manual
- When All Else Fails, Crowdsource the Answer to Find Programming Error Help
- When a Programming Error Pops Up, Be Patient
Welcome back to Edlitera's Intro to Programming series. Before I start diving into the Python programming language, one important thing I want to cover is how to get help if you get stuck.
Programming can be frustrating for a beginner, especially when stumbled by cryptic error messages and things that should work but somehow don't. The Internet, of course, pretty much has all the answers. It is increasingly unlikely that you are the first person in the world running into a specific issue when it comes to programming, and over the years entire communities were built around documenting issues and solutions. Don't be too hard on yourself as you start out programming. So, be patient and don't get discouraged!
How to Find Help: The Internet Knows Everything
Generally my approach is as follows: first, I google it (or, if you don't use Google, use your preferred search engine). There are a couple of tips here. Make sure you include the language name in your query. For example, if you forgot how to read a file, a good thing to search for is "Python how to read files." If you don't include in your query the name of the specific programming language you're using, you won't get relevant links, of course.
How to Handle Error Messages
Errors are something that you will inevitably run into. If you are seeing some error, it will often be accompanied by some text explaining what's going on. When searching online for a solution, I recommend that you use both the error message text and the name of the programming language (in our case Python).
Below, you can see an example of a Python script error. If you're curious, in this case, the issue is that the single and double quote don't match (more on this later in the course!).
Note how the error message provides both the type of error that occurred (SyntaxError), as well as some additional details (EOL while scanning string literal). The error description probably doesn't make much sense to a beginner, and I agree that errors can be a bit cryptic. However, this is enough information to begin searching for an answer.
When searching for answers to a particular error message, it is important to be specific. The more time you spend trying to understand the error or the issue yourself, the better you will be at explaining it and, therefore, the better you will be at searching for a solution. Avoid searching for things that are too general because, again, you will not get many relevant results. Don't feel discouraged as you work through solutions. It's part of the process of getting more acquainted with errors and how to fix them.
Why Programming Language Versions Matter When You Face an Error Message
Finally, pay attention to language versions. The Python programming language has some differences between versions, particularly between Python 2 and Python 3. When going over a solution, make sure it is a solution for your specific version (in this article series, I will only cover Python 3+).
In fact, I would recommend, at least in the beginning to include the language version in your search to make sure that you get solutions that are more relevant for your specific programming language version first.
Image source: https://en.wikipedia.org/wiki/RTFM
When in Doubt, Read the F***ing Manual
Sometimes (though rarely), searching on the web does not lead to a solution. In this case, I will read the programming language documentation. The Python 3 documentation can be found at: https://docs.python.org/3. Python has very good documentation, though sometimes it does take some familiarity with programming in general to understand parts of it. So when you're just getting started, things can be a bit cryptic while you search for help with an error message.
As you get more advanced, however, navigating and parsing the documentation will become easier. When using the documentation, one very important thing to pay attention to is the language version. That URL above takes us to the Python 3 documentation, but you can also find documentation for older versions of Python. Just make sure - particularly if you follow a link from somewhere on the internet - that the documentation is relevant to your programming language version!
When All Else Fails, Crowdsource the Answer to Find Programming Error Help
The documentation is often useful, but in the beginning it can be a bit harder to find the things that are relevant to you. When an internet search fails you and the documentation is also not helpful, you can actually crowdsource an answer.
The best community for asking and answering programming-related questions is by far StackOverflow. In fact, I recommend you create an account there as soon as possible because it's free and you will definitely use it. StackOverflow is so popular that even if you just use a web search to find a solution, the answer will often come from StackOverflow. The beauty of it though is that after you create an account, you can ask your own questions and find help.
When a Programming Error Pops Up, Be Patient
In all my years of programming, I've rarely had to go beyond these 3 steps to find answers to my technical questions. When that happens, however, the ultimate source of truth is the actual source code comments of the programming language itself. Python being open sourced, anyone can have access to its code. However, that is an advanced topic and we will not cover it in this particular series.
One other thing to keep in mind is that the internet offers solutions to specific questions, so sometimes if you are running into a more complex issue, you need to spend some time upfront to break it down into smaller parts or questions you can ask online. Also, even if you do find a solution online, don't just copy paste it into your code. You will get a lot out of trying to understand why things are a certain way and then writing the code on your own.
So, to summarize, if you get stuck:
- Use internet search.
- Read documentation.
- Create an account on StackOverflow and ask questions.
But, most importantly, be patient! Programming is not easy, but it is not impossibly hard either. A key to success is constant practice and the occasional refresher on the theory. Sometimes the best way to solve a problem is to step away from it for a little while and do something completely different. I've solved many, many problems that way.
If you still can't find an answer to your specific question, my advice to you is to simply move on and code something else. It is much better than banging your head against the wall, getting frustrated and then thinking that programming is just not for you. If you don't get something, or are running into an issue that you simply cannot solve, it is best to keep programming, and just program something else. If this is an exercise you are doing, just write it down somewhere and move on to another exercise and come back to it in a few days, or a week. Keep doing that until you solve it.