Programming is a great skill to have. It is hugely rewarding on both a personal and professional level, giving you the ability to build and tinker and invent. It can open doors to all kinds of career paths with great benefits, be it a respectable paycheck, freedom to work when and where you want, or all of the above.
It’s no surprise that more and more people, from all kinds of backgrounds, are deciding to learn to code. But, each person who tackles the task is soon faced with an unpleasant reality: Learning to program is hard.
Complicated and confusing, at first, much of coding doesn’t make any damn sense. Contrary to expectations, the feeling of “I don’t get it,” may persist unabated long into the journey, making once bright-eyed beginners feel hopeless, lost, and ready to give up.
The moral of the story is this: Be prepared. The path to programmer paradise is a long one, and without the right mindset at the beginning, it can quickly lose its appeal.
In this article, I’ll attempt to give you some guidance on what to expect on your journey, how best to go about it, and what tools and resources you may find helpful along the way.
What to Expect
Maybe it’s obvious, but the first thing to make sure you wrap your head around is that programming, at its core, is a technical discipline. The earliest skills you learn will require a lot of “exactness” and “correctness,” and trying to cut corners will get you nowhere. You will have to learn at least a little bit of math, as well as a lot of things that might feel like math, such as procedural logic.
The point is, learning the foundations of programming takes a lot of focus and practice. However, countless people, techy and non-techy alike, have made this journey before you so do not be discouraged. As we will see, there is an abundance of resources for people just like you to help make the process as easy as possible.
The learning curve for programming is steepest in the beginning. There is a huge amount of “fundamentals” to absorb, including the various parts of a programming language (expressions, variables, data types, operators, loops, conditional statements, functions, classes), and the techniques for understanding how much of your computer’s time and memory space your code is going to use (complexity). You will write a lot of code that doesn’t work the first time, so you will have to come to terms with the bane of every programmer’s existence: debugging.
Once you’ve learned how to write code, you will be able learn how to write robust code. Making code efficient, easy to read and understand, and easy to expand on, is an art, and one that is constantly evolving. You will be able to start exploring different software philosophies, and go from simply being a “coder” to being a “software architect.” This is also a process that takes a lot of time and practice, but the better you get at it, the more you will find opportunities opening up for you.
How to Learn to Code
Each person’s journey to programming paradise is different, but there are some good principles that all travelers can benefit from. Here is the basic process I recommend if you are just starting out:
1. Choose Your Destination: Pick a Language, Any Language
If you are serious about learning to code, the language you pick really doesn’t much matter. Most popular programming languages share the same fundamental concepts, and by the time you’ve really gotten the hang of programming in your first language, picking up a new one will be easier than the first time around. If you are learning through a university degree program, or similar, your language will probably be chosen for you.
Here are some general notes on each, to help you decide:
Interpreted languages are easier to get started with. This is because their source code can be run as soon as it is written. In contrast, compiled languages require an extra step between writing and running the code.
|Language||Pros||Cons||Commonly Used For|
When code is compiled, it is converted from human-readable code into optimized machine code before it runs. The result runs much faster and more efficiently than interpreted languages. The compiler that does this must, as part of its job, make sure that everything that has been coded “makes sense,” and, as a result, it can identify and prevent many types of bugs that interpreted languages are susceptible to.
For this reason, it is harder to get away with mistakes or bad code with these languages. They will force you to gain a deeper understanding of what is really going on “under the hood,” and you will learn much more about how a computer really works. The price is that these languages are more labor-intensive, and typically more challenging to learn for beginners.
Compiled languages are used in applications that require performance and reliability, including embedded applications, which may run on hardware with tight resource limitations, and large, complex applications, where even a small bug can wreak havoc.
|Language||Pros||Cons||Commonly Used For|
HTML and CSS: Not Programming Languages
It should be noted that HTML and CSS, which are used in pretty much every webpage that has ever existed, are not programming languages. They are presentational languages, used to define how something should look and what it should contain, but not how it should behave. Nevertheless, they may be a good place to start, because they are much easier to pick up, and will teach you how to type things correctly. In addition, if you plan to do any web development, you will have to learn them at some point anyway.
2. Start Small
Learning takes time, and there is a lot to absorb. If you try to build a complete application on your first day, it won’t work out. To spare yourself the frustration, start by solving small, simple problems, and work your way up.
For example, the first program that is traditionally written when learning a new language is the “Hello World” program, which simply prints the words “Hello World” to the screen. In most languages, it is almost impossible to write a simpler program, and clearly this program does little of actual use. However, it still incorporates many of the fundamental parts of the language, and so it is perfect for introducing oneself to how the language is typed.
From here, you can write something that adds or subtracts some numbers, then something that takes input from the user. You can then learn about conditionals, which are a way to make decisions, and loops, which perform repetitive tasks. Soon enough, you will be ready to build your first object, and at that point you can start to experiment with building complete applications.
3. Be Patient
The core concepts of programming can be quite challenging. Many of them are not at all intuitive if you don’t know already know how the computer works at a deeper level.
For example, when I was starting out, I found debugging to be an infuriating process; it didn’t feel like programming. Instead of writing new code that did cool new things, I would spend an entire day scouring something I had written, trying to figure out, “How did I f*** it up this time?” scratching my head and ready to give up. Eventually, I would discover I had left a single semicolon out somewhere, or used a tab instead of a space, and by the time I got my code to work again, it would be the end of the day. I would feel like a total idiot; it would feel like such a waste of time.
This sort of thing is going to happen to you, and it will drive you absolutely nuts. So, one of the keys to success is this: be patient, and go easy on yourself. Some of the best advice on the subject recommends focussing on the process, not on the goals. If you focus on your eventual goal (“I want to build a website by the end of June”) you will get discouraged, and feel like a failure. By letting yourself take as long as it takes to make progress, you will be more successful.
4. Practice Practice Practice
Like any skill, getting good at it really comes down to practice. There is nothing like doing something, to learn how to do it! Even if you can only spare a few hours a week, if you keep practicing regularly, you will, one day, find yourself knowing how to program. Eventually, you will develop an intuition for things, and something that took a whole day at first (like tracking down a bug), may now only take a few seconds.
When you feel like you have more or less gotten the hang of the basics of programming, a great way to get practice is to start your first project. Think of a simple application you’d like to build, such as a to-do list, or a calculator (again, start small), and give it a shot. This will teach you how to solve architectural and design problems, and build different pieces so that they will fit together into a working whole. These are the essential skills that will allow you to truly call yourself a programmer.
Depending on your goals, learning style, and means, you may want to use different resources along your journey. To help you determine what methods are right for you, here’s a quick summary of some of the tools you can use, ordered, roughly, from more structured learning to less structured learning.
This is the category of options that provide instructors, homework, tests, grades, deadlines, and real consequences if you don’t make your studies your highest priority. These are the options where you will have to go to class or flunk out of the program.