Wednesday, July 30, 2008

How to start learning programming?

In "Teach Yourself Programming in Ten Years" Peter Norvig revealed a recipe to be successful in programming. Here are some points:
  • Get interested in programming, and do some because it is fun. Make sure that it keeps being enough fun so that you will be willing to put in ten years.
  • Learn at least a half dozen programming languages...
  • Remember that there is a "computer" in "computer science"... (or know your computer well)
I based on those points to give advices in QA style and create a list of recommended materials for a newbie who want to start learning programming (as much free materials as possible). Feel free to ask me if you need more information :)

Q: I don't know about programming. What programming language I should start with?

A: Start with a dynamic programming language (Ruby, JavaScript, Python, Perl ...) because it's easier to start and more fun than static type languages (C/C++, Java). You don't need to comply your code in-order to run program. And only with dynamic programming languages, you can interact with program via a command line tool.

Q: Which dynamic programming language should I choose?

A: For me, I prefer Ruby and JavaScript because I know them very well. I will recommend some excellent materials for learn both Ruby and JavaScript. Most of them are free.

You should learn from Ruby Object Oriented Programming (not Class Oriented :) and Meta-Programming.

JavaScript You should learn from JavaScript functional style and prototype-based object oriented.

Q: What next?

A: C/C++ and Erlang.
  • C is today "assembly language". Most of computing systems is built in C: operation systems, database systems, core libraries for servers, desktops, mobile phones and embedded devices. I forgot to mention that, Ruby interpreters, Java virtual machine, JavaScript engines are all implemented in C/C++. So if you want to know the system well, want improve performance and utilize full power of systems. You must learn C.
  • C++: To learn Object-Oriented Programming, Template Meta-Programming, Generic Data Structure and Algorithms in STL (Standard Template Libarary)
  • Erlang: The world is concurrent. Now most of us use desktop or laptop with at least two cores. If 5 or 10 years, our machines will have 8, 16, 32, 64 or event 1028 cores. Sequential programming don't help to utilize their power. In this case, Erlang will help. You also learn about Functional Programming when using Erlang.

C/C++ books
  • The C Programming Language
  • Thinking in C++, vol 1 & vol 2: Very good and free
  • The C++ Programming Language
  • Effective C++: 50 Specific Ways to Improve Your Programs and Design

Erlang materials
Q: Why not Java?

A: Because I don't use Java much in my programming career.

Q: What to read if I want to learn more about "science" in "computer science" that benefit programming directly?

A: I encourage you to read following excellent books:
  • Concepts, Techniques, and Models of Computer Programming (can download draft version): will teach you all the concepts and paradigms of programming: stateless, statefull, concurrent, object-oriented ....
  • Elements of Programming: Math foundation for programming
Above all, the most important thing is: "Before you start learning programming, make sure that you love it and it brings you a lot of fun."

No comments: