How to Learn Computer Languages  “Everybody in this country should learn how to program a computer, because it teaches you how to think.” Steve Jobs, Visionary, Founder of Apple Programming languages can be very intimidating, but one thing to understand is that human language is much more complex than any coding language. Computers are built to follow your instructions. You give them commands and they follow without inserting their own understanding or bias, and are based entirely on logic. This chapter covers the basics of learning computer languages – from the fundamentals to becoming job-ready coders.  The Fundamentals The first step to learning any programming language is the syntax. The fundamentals will always be similar: variables, operations, conditionals, and functions. This is an important stage because it will be the foundation for more advanced concepts later. What are fundamentals? Here are some examples: •Variables •Data types •Conditionals •Operators •Comments •Functions •Loops •Scope •User input •Debugging •Error handling •APIs When learning these concepts, do not pressure yourself to understand everything right away. If you see other students pro- gressing faster or if it takes you a while for the concepts to click, that’s okay! Absorb the information and keep searching for answers, and understanding will follow. The most important thing is to correctly learn these fundamentals first. You can build some cool projects with many tools that people have built to help you write code faster, but if you do not fully understand the basics of programming, you are going to strug- gle to generalize and adapt your knowledge to new challenges you face. Understanding the fundamentals of a computer language well will take you far in this career.  Tips for Starting First, do not stick with one learning style if it is not working for you. Do not ever think, “I do not get it, I must not be smart enough.” If you cannot understand a concept, then perhaps it is not being explained to you in the right way. Maybe you need a different in- structor or a different medium. Make sure that your learning materials align with how you best absorb information. If you prefer books, then borrow or purchase a book. If you prefer video courses, then you can surf YouTube or go to one of the many sites with video courses (I recommended some earlier in the book) and find some great videos on any language or topic to put in your cur- riculum. Second, do not pick large problems to solve right away. Before you tackle a large passion project, you need to throw away some projects and become comfortable coding in a sandbox before you get out into the real world of programming. This will help you as- sess your abilities and cultivate realistic expectations. More often than not, beginners quit if they set their expectations too high ini- tially. Build small tools and apps, then medium-sized tools and apps, all the while writing and reading plenty of code as you go. You should work on your passion projects last, helping you avoid the mistakes and headaches caused by unmet expectations. While you are learning, you will likely encounter several online tutorials. Online tutorials and walkthroughs often do not bring up the bugs and issues that you might face. The coding process looks perfect when you are reading through a well-written article or watching an edited YouTube video; the person makes no mistakes and the project just goes smoothly. That is not reality. Usually bugs and issues are edited out and the senior developers who make those tutorials have spent years solving the bugs that you are going to deal with. If you are struggling to relate to a senior developer on YouTube, go watch some programming livestreams on Twitch or YouTube (especially mine!) and you will see plenty of mistakes with live debugging. Do not forget that when you are following a tutorial, something that works in someone else’s browser on their particular oper- ating system might not work the same on your machine. There is a meme that says “Works on my computer” because this is such a common thing that happens. Programs work invariably in different environments sometimes. Do not get discouraged if a tutorial is not working correctly for you, just do the best you can and try to follow the problem solving steps I list later in this chapter.  Avoiding Outdated Information When you are looking up information or coding resources online, make sure you check the date it was published and what versions of the technologies they are teaching. If the tutorial or resource is more than 3-4 years old (and sometimes even less than that) it is probably using an outdated version and it is better to look for something more up to date. Technology changes very quickly and you are bound to run into issues from using old code or material. The exception to this ”date rule” is concepts. Software development and computer science concepts usually withstand the test of time, unlike specific technologies. You should also check the versions of languages and libraries (tools) that you are using. In software, versions usually consist of three numbers separated by periods. For example, 1.2.8 or 3.0.24. Each number starts at zero and increments every time the code is updated. The type of coding changes will denote which of the three numbers increments. The first number is called the major ver- sion, where there will be a huge difference between versions, significantly decreasing the likelihood of full compatibility with pre- vious versions. So, if you are looking at a library that is currently at version 4.0.2, then you should not look at any tutorials or re- sources that cover version 3.x.x or 2.x.x or 1.x.x, only 4.0.0 and above. However, if the library is version 3.5.5, then you can probably following along with a tutorial or use code from a Stack Overflow answer that is from version 3.1.0 because the major version is the same. More on copying code from sites like Stack Overflow later on. It is the same with programming languages, too. Check out the latest major version for the language you are learning and try to stick to resources that cover that. If you are learning Python, make sure you are using the latest major version, Python 3, and not looking at outdated code from Python 2 or before. It is always good to start with the latest LTS (long-term support) or stable version if you can. For example, Python’s latest stable version released is 3.9.0.  Solving Problems Programming is not about the being able to type fast, be a genius, or know a lot about math – it is about problem solving. When you learn how to break down problems into individual steps and then solve each one according to best practices and recommended pat- terns, you will be ready to get your first job as a developer. The Programmer Mindset When you first start coding, work to develop a programmer mindset. We are taught in (most) schools to follow instructions, but when you are learning to code, you must throw that notion out the window. The best way to learn to code is to break things, to ask yourself, “What if …?” often. Treat the language like a playground. Try changing things and see what happens. It is important to not just follow code-along tutorials but to break out of what the tutorial is doing. The students I have seen who adopted a programmer mindset early on and continued to ask ”why”, did much better overall than their peers. This is something you have to consciously work on, it is a mindset change! Here are some ways to start practicing this: When you are following a tutorial or building a project, comment things out, move things around, change variable names, rearrange files. Do anything to break out of that mindset of following steps in order. Did you get an error? Did the program run differently at all? Take note of what happens when you make changes. You are capable of doing this! Start practicing now. Thinking in Logic Daniel Lomelino, a senior instructor at the Kenzie Academy coding school, says, “One of the biggest problems that students have is not understanding the problem. They jump into the code right away and get stuck on small implementation details and forget about what they are trying to solve.” He says that he always tries to help students see the bigger picture and then break things down into steps. It is important to figure out ”how” to do something before deciding on ”what” to do. Here are the problem solving steps that he recommends following: 1.First, try to understand the problem and figure out how you can best do that. It might be writing out the problem in your own words or pretending to explain the problem out loud to someone (this is known as rubber ducking in the pro- gramming world). 2.Break the problem up into small, manageable steps. 3.Write pseudocode for the logical steps. Pseudocode is typically a series of comments in your code (or words on a paper or a greaseboard) that describe what the code might do without writing real code yet. It is quite useful for quickly stepping through problems. 4.Then try to solve the problem step by step. If you have already gone through these steps and you are really stuck on something, start over. Save your current code some- where or comment it out and re-write the whole program or file from scratch. Sometimes this ”nuclear option” technique catches less obvious errors that you made. Practice these steps with problem solving and find the techniques that work best for you. Then, share them with me! Debugging Bugs are issues or mistakes in your code that can cause your programs to stop running (”crash”) or behave in a way that you did not intend. Sometimes bugs are obvious to detect, such as when you misspell a word or forget a semicolon that causes your program not to run correctly. Sometimes they are not as obvious, like when you are trying to import someone else’s library into your program and it does not work as expected. Debugging (the act of attempting to fix bugs) is a good opportunity to see where you need to improve and to practice your prob- lem solving skills. There are courses that teach debugging skills which can be helpful, but for the most part, you must pick up these skills through deliberate practice. Running into difficult bugs is one of the most challenging parts of programming and, unfortu- nately, it discourages many beginners . I talked about needing a mindset shift a little earlier in this chapter regarding thinking like a programmer. A change of mindset is also needed for debugging. When you see error messages or your program is not working correctly, becoming upset or frustrated is not helpful. Instead, appreciate those moments because they make you grow the most as a programmer. If you never ran into difficulties, you would have no opportunities to practice problem solving skills, which you must master and continually improve to be a successful programmer. Error messages are there to help you. Next time you see an error, really take your time to read it line by line. Most of the time, somewhere in the error message, you will see file and variable names that you recognize. Look at where those error messages are pointing to. Usually it will give you a filename with a line number of where the problem happened in your code. From there, you can try commenting out lines of code to isolate the problem. You will also probably have to print out the value of variables (and the type of the variable if you are using a language like JavaScript or Python). You can fix the most common bugs with these steps. If you still cannot figure out how to solve the bug, try copying your error message (remove any specific variable or file names) and pasting the error text into an online search engine. You will probably see that other people have asked about this error before on sites like Stack Overflow or in a Github issues section. Sometimes you can quickly see the answer to your problem and other times, you will see many people offering up different solutions. In the latter case, you should read through all possible solutions and their explanations before choosing one because you will not have the experience to discern which solution is the best by just looking at the code. This will come with time and practice. TIP: Should you copy code? ”Code monkey” is sometimes used as a derogatory term for developers who just copy code, but it is not always bad to copy. No one can remember every bit of syntax and all of us use bits and pieces of each other’s code in one way or another. Copying has a negative connotation because sometimes people copy snippets of code without understanding how they work. Random pieces of code strung together like this can lead to a very unstable codebase. Make sure you understand what the code is doing before you paste it into your program. Copying is a shortcut, not a replacement for understanding. In the beginning, do the extra research to know what the pros and cons might be for the block of code that you want to copy. If it is using a ”reduce” method, for example, and you have not encountered that before, you should look it up and try out an example first. Copying is used when you need a solution to an acute problem or you do not remember the exact syntax that you need to use, and if you encounter some methods or terms you have not seen before, take the time to do some research instead of blindly pasting into your code and expecting it to run. When you are experienced, you will be able to look at a block of code and know what it is doing and be able to quickly determine whether to use it or not, or at least where to find more information. Leveling Up You need some level of hand-holding at the beginning for direction, but do not get too comfortable. While you are learning, you are also working toward becoming a software craftsman, a professional trying to create the only the highest quality software. You can reach that next level by practicing your problem solving and debugging skills.. Here are some more tips I have for you based on my experience (many of these are mentioned elsewhere in the book and are just being compiled together here): Always Try to Think in Terms of Challenges, not Annoyances Learn Programming Patterns and Paradigms Learn Algorithms Learn Computer Science Learn How to Write Tests for Your Code: People often neglect writing tests to make sure their code is working properly. They just assume that it is fine (and will stay fine) and move on to writing more code, making the long-term mainte- nance of the software much more difficult. Testing is important because helps you write better code, that is easier to maintain and it impresses companies. In fact, learning how to write tests might make you stand out as a developer more than anything else because so few software developers can write tests. Practice Reading Documentation: Every language or tool you will use will have some information and instructions for its use on a website. This is what we call documentation, or docs for short. You will hear many people say, ”read the docs,” or things like, ”you do not need any other resources, just look at the docs.” To a beginner, documentation can be somewhat confusing, so it’s better to use a resource, like one of the courses or curriculums I mentioned in previous chapters until you become more comfortable with the coding terminology. However, as you level up past the basics and gain more understanding about programming, it is important to learn how to read and understand documentation on your own. These docs can be intimidating at first, but just start reading them without pressuring yourself to understand everything. Soon you will be able to understand and navigate documentation, which will help take you to the next level with your coding. Read Lots of Other People’s Code Practice Reading Source Code Learn Some Digital Security Basics: It is vital to understand that any code that we write and deploy somewhere could be vulnerable to malicious actors trying to steal data or intellectual property. This could include SQL Injection, cross-site scripting, man-in-the-middle attacks, etc. I recommend learning from security professional, Nathan House. He is very experienced in the industry and is a great teacher with courses on Udemy and his own website, stationx.net. I have learned a lot from his courses. Read Books About Concepts and Techniques: For example, Clean Code by Robert C. Martin and, The Pragmatic Pro- grammer by Andrew Hunt and David Thomas. Watch Conference Talks: Find ones that cover topics in your field of study and about software development in general. A lot of these are free on YouTube. Maintain Code Quality: Take care of yourself and always double check any code that you wrote when you were tired or feeling stressed. Here is a Twitter thread about the topic that I found to be very insightful: twitter.com/hillelogram/status/1119709859979714560.  Conclusion Learning to code can feel like an emotional roller coaster – one moment it can be scary, intimidating, and overwhelming and the next it is exciting or exhilarating. You need to mentally prepare yourself for the challenges coding can bring, and try not to sweat the small things. I highly recommend you check out the talk, How to Think Like a Programmer, by Andy Harris (it is on YouTube). He is a devel- oper from my local Python user’s group and was a huge inspiration for me writing this chapter. In the video, he goes into more de- tail about some of the things that I talk about in this chapter. Action Steps:  1.Spend a lot of time getting good at the fundamentals and really understanding them. 2.Practice your problem solving skills as much as possible. 3.Always strive to level up as a software craftsman.