Monday, June 15, 2009

How to become a programmer

A lot of people aspire to learn programming, and it's not an easy task (there are countless pitfalls that aspiring programmers typically parade into like lemmings), so I figured it would be useful to outline a path acquire that goal.

1. Learn an imperative scripting language. Become confident in a simple language in which it is easy to write functional stuff fast. Not only does this serve as an introduction to imperative programming, it will also be useful down the line when you want to get stuff done quickly without all the red carpet other languages typically come with. Python is probably the best language to start off with, but there are other options as well (ruby, perl, lua, etc.), and they're all good choices for a first language. My motivation for suggesting python is the great community surrounding it, and the libraries it ships with that makes rewarding projects such as simple game programming relatively easy and quick.

(The order in which you take the following two doesn't really matter, do both simultaneously if you want.)

2a. Learn a functional language. Once you've gotten imperative programming down, it's time to learn something that will blow your mind, and fundamentally change the way you think about programming. Lisp or Haskell are good choices. Pick your poison.

2b. Learn a low level language. Low level programming will teach you what actually goes on under the hood. C is probably a good place to start. You may want to try assembly as well: It's a pretty easy language, but only really worth pursuing if you enjoy it.

3. Learn an object-oriented language. Now that you know a fair deal about programming, it's time how to write a lot of code while still keeping it manageable. That's where OOP comes into the picture. You'll probably want to learn some of the following: C++, C# or Java (the two are more or less identical).

Now that we've dealt with what to learn, it's time to discuss how to learn it. It is my opinion that tutorials are dangerous as hell to new programmers. There is no way to verify who wrote the tutorial (it may be some confused 14 year old, no offense to the 14 year old programmers out here), they come in no particular order and are generally inconsistent. The proper way to learn any language is to:

  • Buy a book. Check the reviews as well. You can also ask around the programming community as to what book is best on the subject. You may get away with official online documentation in some languages (e.g. python), but as a general rule, you want a book.

  • Practice. Write programs. Make them small, make them large, make them silly, make them serious.


Taking classes in programming may or may not be useful to you. It can be helpful, but what really makes a difference is how much you practice.

Something is also to be said about the company you keep. You can soak up a lot of programming skills by hanging out at places like the coding forum at www.forums.xkcd.com, and that goes for people at any skill level.

Finally, there are some horrible traps you can walk into.

  1. Don't start in web design. First you need to learn HTML (which has nothing to do with programming at all), and then some abomination like PHP (which teaches terrible coding practices.) A background in web design is salvageable, but it is a damn tar pit.
  2. Don't start in C++ or Visual Basic. Starting in C++ is like putting a 5 year old in the pilot's seat of an airliner: It isn't going to understand 1% of the features, and will probably crash and burn (badum-ching); and Visual Basic is a crime against the mind.


This of course represents my opinion. There's as many answers as to how to become a programmer as there are programmers.

TL;DR: Learn python first.

10 comments:

  1. Starting out in web design is a damn tar pit, but I feel that it can be defensible. I started out with HTML, and almost immediately ran into javascript. Javascript, I think, was the perfect place for me to start. It was super portable, all I needed was a text-editor and a web browser. Familiar territory. I didn't use any special libraries, so it was super simple. Very few native functions or reserved keywords (that I knew of, at least). After working with javascript long enough, I was much more comfortable moving on to C++/perl/asp/etc.

    Also, books are probably the most important resource for getting started. It's good to have a resource that is well rounded, and that you can walk through step-by-step.

    ReplyDelete
  2. That may be true. Web programming has improved the last couple of years now that javascript is reasonably consistent and usable (back when in the day you used to need to write the same code in 7 different ways just to get it to work on -most- browsers). Though I'm still not convinced it's an ideal place to start. It teaches you a lot of strange things that are consequences of the special circumstances that surround web programming. But I guess your mileage may vary.

    ReplyDelete
  3. I'd like to add something about taking classes, and that is to make sure that the class you're taking will actually teach you something. This shouldn't be too big of a problem in college, but in high school it's another issue. Basically high school teachers don't have to know a whole lot about what they're doing. The programming teachers tend to be computer teachers who may have taken a programming class in college, and there is really no guarantee that they will have any idea what they're doing, and since these classes tend to be electives not too much attention is paid to them. Web design classes are usually worse, because you'll most likely be learning to use Dreamweaver from a teacher whose knowledge of what they're doing is about 10 years out of date.

    So the moral of the story here is: if you're going to take a programming class and you're in high school, ask friends who've taken it if the class is worthwhile.

    ReplyDelete
  4. Yeah, that is also true. I found myself suffering through a mandatory programming class in High School. Teacher didn't know diddly squat, to the extent where it was downright painful to attend classes. So much cargo cult programming from a single person I have never seen. Didn't want to correct him too much, either, because it would be annoying as hell for the other students.

    ReplyDelete
  5. Thanks alot, I am really interesting in teaching my wife to program, as I urgently need help on coding and she recently lost her job...

    She already does basic python stuff and knows Joomla in and out.

    Thanks

    ReplyDelete
  6. Learn Rebol you will able to learn both imperative, functional and oop:
    http://reboltutorial.com/rebol-javascript

    ReplyDelete
  7. At my University (many years ago) we learned programming using Simula. That is the perfect beginner language in my opinion. You learn the difference between an int and a String and you can start out with imperative programming, and later use objects without learning a new language.

    I also like the way the language forces you to think of pointers and values differently. Example:

    a := 1;
    a :- "This is a string"

    We basically started making simple programs using standard structures (for/while loops and arrays) so that we got the basics of programming right. Later in the semester we started using the object oriented functionality.

    You can do all this with Python also, but static typing is something I think programmers should learn first.

    Unfortunatly the University changed to Java to be "cooler" :/

    ReplyDelete
  8. I find the valuable information is provided by you.

    I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

    ReplyDelete
  9. Hi,
    I am Programmer with Chessboss.com. Chessboss.com is absolutely FREE chess server where you can play chess,create your own tournament with players online. No Gambling and explicit talk. This website is purely meant to increase the fan-base of chess and for entertainment. I Need your help to promote the FREE chess server around the world. I would like to be on your blog as i found it a useful and informative resource. By adding chessboss.com you will recognized and added as a top resource on our chess server. I really believe in FREE flow of information. I have included the code and title.

    Please email me back with subject line of your URL for the featured resource code. This is to avoid spam and to make sure you get the award.

    I hope you understand and co-operate with us.

    Thank you,
    Sophie Vierra
    Programmer
    www.chessboss.com.

    ReplyDelete
  10. In my opinion, I work as a programmer is very interesting, clever and often unpredictable.

    ReplyDelete