David Winiecki's blog
Tuesday May 6th, 2014
Programming is super fun! The more you do it, the more fun it gets.
To get started programming, you need to know
The more you know about computers and math, the easier it will get, but that's all you really must know to get started. When you get into more advanced programming and when you want to create scientific or graphical programs, more advanced math (algebra, geometry, etc.) will become increasingly useful.
One place to start learning any given language is to just google tutorials for it, for example "JavaScript tutorial". This is guaranteed to get you started, but what you find may not be the highest quality or the easiest to learn from. (For some languages, more info on how to get started is below.)
I don't feel qualified to recommend very many books or tutorials, but generally if you're looking to buy a programming book I find it useful to look for books on Amazon that have at least 30 reviews and an average of at least 4 stars. Also, check these out: Bento - Free books - Lifehacker: Which Programming Language Should I Learn First?
Good places to get help when you get stuck are stackoverflow.com and irc.freenode.net. To use freenode, you need an IRC application like LimeChat. Then join, for example, the #ruby channel to ask questions about the Ruby language. More about IRC.
WARNING! If you are a child, ask your parents before connecting to freenode or any other IRC server. Online chat can be seriously dangerous for kids!
In both cases, on forums like stackoverflow and IRC servers like freenode, it's important that you put significant effort in before asking a question. If you've put some time in and you're still stuck and can't find the answer, mention what you've tried when you ask your question. People are much more likely to give good answers when they know that you're doing your part to work hard and learn.
Here I describe what I understand are the most important and most mainstream programming languages and some reasons why you would choose them.
These languages are a bit more difficult to grasp at first, but in the process of learning them you learn a lot more about how computers really work, which is extremely valuable. Other languages will get you started faster, but you'll miss out on a lot of understanding about what happens behind the scenes.
My first programming language was C++. I recommend Starting Out with C++ by Tony Gaddis.
Objective-C is typically only used for programming OS X and iOS apps. iOS apps can only be created using Objective-C.
After a year or two of studying one of these languages, you may want to try learning an assembly language. In the process you will learn about the lowest levels of how software works, just short of how the digital electronics are structured and how they function. (And if you want to go even further in that direction, Digital Design and Computer Architecture by David Harris and Sarah Harris is a great book.)
These languages put you a little further away from the CPU hardware, so you will learn less about how your computer really works, for example how data is stored in memory. But hiding those details also allows you to focus more on other programming concepts.
Android apps can only be created using Java.
Java can be used on Windows, OS X, Linux, and Android.
C# can only be used on Windows, but has some advantages over Java that can make up for that.
For all of the 5 languages above (some more than others), getting the language installed and running on your computer for the first time can be complicated. Some people are extremely passionate about learning programming and may be able to overcome these obstacles on their own. But others may just be a little curious, and may not feel it's worth it to them to put huge effort into it. Whether or not you feel extremely committed, you still deserve a chance to give programming a try, because it's a lot of fun!
That said, do you know a friend who knows one of these languages and would be willing to help you install and set up the language on your computer, preferably in person? If you do, don't be shy, they'll probably be excited to help you get started. If not, that may be a good reason to learn one of the languages below first, because they are easier to get up and running.
(Although, keep in mind that during your programming journey there will be times where significant persistence and patience are necessary. This is true regardless of which language you choose to learn first. Just remember, problem solving is a valuable skill, and persistence is required to gain it.)
These languages can be used on Windows, OS X, and Linux. Like Java and C#, they hide some of the low level details, so you won't get a chance to learn about those, but things will be simpler.
Python is a great first language because its syntax (all the funny symbols it uses and how they're arranged in code statements) is very simple and clear compared to other languages.
It's a tricky question whether to start with Python version 2 or version 3. It's kind of a toss up. But if you choose it as your first language, it's probably a good idea to start with Python 3. Download - Official tutorial
Ruby has syntax that is simpler than most but maybe a bit more complicated than Python's. Personally I think I have the most fun with Ruby. Also, tutorials for Ruby tend to be funny and quirky. Ruby is a fantastic language for creating web applications because of the Ruby on Rails framework.
If anyone tells you to learn PHP, run away screaming and then learn Ruby instead.
To start learning Ruby, Try Ruby.
After that, install Ruby. If you use OS X or Linux, I recommend installing Ruby with RVM.
(After a few weeks you should check out the Pry Ruby gem. It's very handy.)
JavaScript is the easiest language to set up because there is no setup. You can play with it in any web browser. It seems like most developers recommend Google Chrome.
JavaScript has a syntax that is closer to C and Java, but conceptually has a lot in common with Python, Ruby, and some other languages not mentioned here.
One downside to JavaScript is that it seems to have more pitfalls and gotchas than Python or Ruby, without the added benefit of learning more about computers that you get from the other languages listed above. But JavaScript's biggest asset is that it is the only language you can use in a web browser, and web apps are special because they require no installation and can run on any platform (Windows, Linux, iOS, etc.). There are also libraries like Underscore.js and jQuery that ease a lot of the pain from JavaScript's unpleasant surprises.
Also, a couple of tools you should know about:
jsfiddle.net is handy for sharing code with other people through the Internet (say you're in a chat room and want to ask someone why your code isn't working) or playing with JavaScript.
JSLint will tell you all kinds of things about your code. If you get an error you don't understand, google it. You don't have to do everything JSLint tells you to get a working script, but by using it you will learn a lot about the best ways to use JavaScript. If you use it, then use it when you're first starting a new script. If you try to put a big script in after you're nearly done, you will probably need to reformat your code extensively, which is kind of a drag.
A few differences between these languages are mentioned above, but if you still feel that they're all pretty similar and you're in a good position to choose any one of them, the last criteria to look at is how likely these languages are to be relevant in the future:
So they really are all good choices for a first language if you're in a position to succeed. (See above for obstacles that may make it difficult to learn a particular language.)
Programs are created using text (letters, numbers, etc.), but you can't use Microsoft Word. Microsoft Notepad can be used but it's a poor choice. TextEdit on OS X can be used but it's not ideal and needs to be set to plaintext mode before you can use it for programming.
Instead programmers typically use IDEs and special text editors. Some great text editors include Notepad++ for Windows and Sublime Text for OS X. (Or if you want to be hard core, I enjoy using Vim, and some people like Emacs.)
If you use Windows then you will probably end up using Visual Studio (an IDE) for C, C++, or C#. I don't know of good alternatives, if there are any.
For Java you can use Eclipse or NetBeans, which are IDEs, but it's often much simpler to just use a text editor and compile and run Java from the command line or terminal. I encourage you to give the different alternatives a try and decide for yourself.
For Objective-C you will probably want to use Xcode.
For C and C++ not on Windows, and Python, Ruby, and JavaScript (and HTML and CSS) on any platform, I recommend using a text editor.
One of the best ways to learn to program well (besides lots and lots and lots and lots and lots and lots and lots and lots of practice) is to read code written by other programmers, especially the source code for libraries and apps that people use all the time. Good examples include the Linux kernel, the Ruby standard library, and SQLite. You can find tons of stuff like that on GitHub.
After you've been programming for a few years it's wise to learn a high power language like Haskell or Clojure (Lisp). I haven't done this yet, but the benefits seem huge.
Note: If you're an experienced programmer, you may have noticed a few points where I state something like "it's impossible to do X with language Y." In many cases it actually is possible but it's also inconvenient or there is a relatively small community behind it, and I want to keep this simple and set beginners up for success.
comments powered by Disqus