In many ways programming is one of the most easily accessible skills you can learn. There is no formal education required to get started, and there is a vast ocean of resources available for free on the internet. In fact, many professional programmers are self-taught.
At the same time, if you've never done any kind of programming before it can be really intimidating at first. How do you know where to start or who to ask when you have questions? Not that long ago, you just had to tinker around with code trying to figure out how it worked on your own. Now there are many tutorials and forums specifically geared toward people with zero programming experience.
Choosing a language
So where do you start? First you need to figure out what language you want to learn. There's a good chance that eventually you'll want to learn more than one language, but just stick with one for now. The language you choose really depends on what your goal is for learning to program. In the table below I list a few example languages for different purposes. If you don't have a particular goal I recommend starting with something easy like HTML or Python.
At the same time, if you've never done any kind of programming before it can be really intimidating at first. How do you know where to start or who to ask when you have questions? Not that long ago, you just had to tinker around with code trying to figure out how it worked on your own. Now there are many tutorials and forums specifically geared toward people with zero programming experience.
Choosing a language
So where do you start? First you need to figure out what language you want to learn. There's a good chance that eventually you'll want to learn more than one language, but just stick with one for now. The language you choose really depends on what your goal is for learning to program. In the table below I list a few example languages for different purposes. If you don't have a particular goal I recommend starting with something easy like HTML or Python.
Front End (web stuff)
|
|---|
HTML, CSS, PHP, Javascript, Ruby on Rails
|
Back End (server stuff)
|
Python, C, C++, C#, Scala, Java, Ruby on Rails
|
Phone Apps
|
Objective C / Cocoa (iPhone), Java (Android)
|
Databases
|
SQL (pronounced "sequel"), PostgreSQL
|
Research
|
MATLAB, R, Python
|
Once you've picked a language you'll probably want to jump right in with the installation and online tutorials – but wait! There's one important step that will make your life much easier. You should learn a little about the command line.
The command line
The command line is a text-only interface to your computer. Not only do you use it to install and update things, you can also use it to navigate around your computer (including to hidden files and folders), and to automatically rename, copy, move, and delete large batches of files (there are also many other cool things that it can do which I won't cover here).
On UNIX operating systems (i.e. Mac and Linux) the command line is accessible through applications called Terminal (for Mac) and Konsole (for Linux). The default "language" (called a shell) is Bash. (Windows is something different entirely, I don't know much about that, sorry!)
It may seem like a pain to add this extra step, but I promise it will be worth it later on. Unfortunately I've found that many great programming resources on the internet assume that you already know how to do basic things on the command line, so not knowing about it can be a huge barrier for someone just starting out. I suggest these two tutorials: An Introduction to the Linux Command Shell for Beginners by Victor Gedris, and Learning the Shell by William E. Shotts, Jr. They are both very short and clearly written, and will give you a solid foundation for navigating the command line.
EDIT: I realized belatedly that I neglected to include an optional but important step here – setting your default command line text editor. Once in a while you may want to edit a file using the command line (such as hidden files or git commit messages), and unfortunately the default text editor for UNIX systems is something called vi. Vi is really obtuse and I do not recommend it. (Honestly, why should you have to google how to save and exit in your default text editor? That's the opposite of user-friendly.) Instead, I recommend a simple editor called nano. To change your default editor, follow these steps:
1. Open the command line (see above) and type the command:open ~/.profile(this will open the hidden profile file in your default text editor)
2. At the bottom of the file, add this line:export EDITOR=nanoand then save and close the file
3. Repeat steps 1 and 2 above, but this time replace .profile with .bashrc
4. In the command line, type these two commands:source ~/.profile
source ~/.bashrc5. Enjoy using nano
Installation
Next step: installation! This part is actually pretty simple, and it's different for every language, so I recommend that you just search for the language you want to learn and follow their instructions. The only side note I will add is that there are things called package managers which make installation and updates easier by packaging together all the other dependencies your program needs to run. You're not required to have a package manager to install a language, but they can sometimes save you a lot of time.
Tutorials
Whenever you're just starting out in a new programming language it's a good idea to take a tour, familiarize yourself with the syntax of the language, and learn about some of it's basic features. This is the kind of information that a tutorial provides. Programming tutorials are very diverse; each one assumes a particular level of experience between "I've never typed a command before" and "I already know five languages, what's special about this one?" It's important to find one that meets you on your level.
There are many, many tutorials available for free on the internet for just about every language you might want to learn. Here are just a few that begin at a very basic level.
Learn Python The Hard Way
The thing I like most about this tutorial is that it starts off very simple and each step is very incremental so you don't get lost along the way. I also like that it tackles some difficult concepts, like debugging, object oriented programming, and inheritance. Essentially, this tutorial doesn't just try to teach you how to program, it also tries to teach you how to think like a programmer. (The tutorial is free online, and there are also videos and other extra materials available for purchase.)
Codecademy
The best part about Codecademy is the way it makes programming fun and interesting by giving you useful, realistic projects. Each lesson is accompanied by a tiny fully functional project or game that helps you practice what you just learned. For example, the very first project for Python is a tip calculator – what a creative way to teach basic number operations! Codecademy tutorials are available for HTML/CSS, Javascript, jQuery, Python, Ruby, PHP, and APIs.
Khan Academy
If you're interested in free self-guided learning online, Khan Academy is one of the best resources available (maybe THE best?). The founder, Salman Khan, gave a nice TED talk in 2011 about the origins of the site. A couple years ago they added a complete Javascript tutorial, and it looks amazing! The highlight of Khan Academy is the free videos, which are easy to follow and much more engaging than reading a book or tutorial online. Since they are in Javascript, the lessons are also much more visual and interactive. Finally, I want to point out my favorite part of the Khan Academy tutorial – at the very end there is a section on Becoming a Better Programmer! I think it's important for tutorials (like this blog, even) to recognize that they won't be able to cover everything, and to point people towards good principles and other helpful resources they can turn to when they get stuck.
(A short note about text editors: many tutorials will suggest that you use the default plain text editor on your system, e.g. Notepad or Textedit. That's fine, but there are certainly better programs out there. By far the best one I have used is Sublime. Serious programmers also use editor "languages" which allow quick navigation and editing through keyboard shortcuts. The two most popular are Emacs and Vim. But really, just stick with Sublime, it's awesome.)
Next step: make something!
The one piece of advice pretty much every programmer will give you is that programming is a skill that you learn by doing. Once you have the basics, the next step is to make something real that works. It's even better if you can think of something you might use in your everyday life. If you don't have any ideas, there are lots of great suggestions online. For example, here are two project lists: one for front end programming, and one for back end.
How to find help
When you get stuck (and you will!) there are several good places to ask for help. First, programming languages usually have a help function that brings up a short written explanation of each command, often with examples of how to use it. Use google to find out how to access the help function for your language.
Second, if you're still stuck, search for your problem online. Try to include some key words, like the name of the language, the function, and the error you're getting if there is one. It also sometimes helps to type your query as a question (like "how do I add two numbers in python?") or even paste your error into the search box directly. Chances are someone else has faced this problem before and some other nice person has kindly taken the time to answer their question. If you don't find the answer right away, keep looking and maybe try changing your search terms. Like everything else, it takes practice to search for the right question, too.
If you still can't find your answer, you can post a question on a support forum like StackOverflow. A word of caution for beginners: it's sometimes hard to express your question in a way that other people can understand and help you. Just as there are good people on the internet there are also rude and obnoxious people as well. Be patient with the strangers giving you free advice, and if they seem frustrated with you try to understand why. At the same time, don't take it personally if they're rude!
Lastly, if you're learning a particular library within a language there are often community support forums and email listserves for users of that library. These smaller communities are often friendlier and more responsive to questions, and sometimes you'll even get a reply from the original author of the library themselves.
There are many more topics regarding learning to program which I didn't cover here, so feel free to comment if you think I missed something or have a suggestion. Thanks for reading!
No comments:
Post a Comment