16

This is a fairly general question. I know a bit of Perl and Python and I am looking to learn programming in more depth so that once I get the hang of it I can start developing applications and then websites.

I would like to know of an algorithm (sequence of steps :)) that could describe my approach towards learning programming in general. I have posted small questions on Perl/Python and I have recieved great help from everyone.

Note:- I am not in a hurry to learn. I know it takes time and that's fine.

Please give any suggestions you think are valid. Also, please don't push me to learn Lisp, Haskell etc - I am a beginner.

Nicole
  • 28,111
  • 12
  • 95
  • 143
user9057
  • 179
  • 2
  • 4
  • Is there any particular language you are looking to learn? I know you mention perl and python, is that what you are looking to get into? – Jason Dec 03 '10 at 11:01
  • So what you're asking for is... what exactly? The process by which you learn a specific language? Programming itself? Using what? – glenatron Dec 03 '10 at 13:56
  • I think this is a good question. I've edited to make it a bit clearer. – Gary Dec 03 '10 at 15:11

5 Answers5

28

The 11 step algorithm for learning a new programming language

I'm currently in the process of learning Lisp, and I'd recommend the following algorithm:

  1. Ask around if the language is worth learning and where good resources can be found. If positive responses to the language are given by experts then proceed to step 2.
  2. Create an initial programming environment. Keep it simple: text editor and compiler/interpreter. The bare minimum. Consider a specific user account on your machine with a special colour scheme to cue the change of mindset.
  3. Create the "Hello, World!" application.
  4. Learn general syntax and control statements (if-then-else, repeat-until etc). Create sandbox to verify simple control cases (true/false evaluations etc). Try out every primitive type (int, double, string etc). Perform currency calculations. The number guessing game (as suggested by @Jeremy) is good for this.
  5. Create class (if applicable) with several methods/functions. Make calls between functions. Apply control statements.
  6. Learn arrays and collections. Create suitably complex examples that create arrays and collections of each of the classes/functions/primitives that are available to you
  7. Learn file IO. Create examples of reading, manipulating and writing binary and character based files.
  8. Ask more questions about idiomatic programming within the language (pointers, macros, monads, closures, support frameworks, build environments etc).
  9. Choose (or adapt your existing) IDE to work in the recomended idiom.
  10. Write a variety of applications that please you (or your boss).
  11. After 1 year return to step 1 for another language while maintaining your interest in the one you've just been learning.
Gary
  • 24,420
  • 9
  • 63
  • 108
  • 1
    I have found the "number guessing" game to be a great second program to write. (At step 4.) It allows you to learn about integers, booleans, text input/output, looping, and conditions. – Jeremy Dec 03 '10 at 14:38
  • @Jeremy Good suggestion, I've put it in there. – Gary Dec 03 '10 at 14:46
  • Hi Gary- thanks for the detailed instructions i will try to map it with python - very good step by step explaination thats why i love this chain of forums... @Jeremy yeah i am on it :) – user9057 Dec 06 '10 at 08:29
  • *special colour scheme to cue the change of mindset*, can you shed some light on this? – Santosh Kumar Feb 07 '13 at 04:44
  • I tend to choose a darker colour scheme when working with Lisp but use a light one for Java. The colour reminds me to switch my mindset. – Gary Feb 07 '13 at 07:35
12
while (stillLearning)
{
    read(some);
    practice(lots);
}
Steven A. Lowe
  • 33,808
  • 2
  • 84
  • 151
2

For every language you want to learn L

  • Step 1: Learn the syntax of L.
  • Step 2: Write a compiler for L in your favorite language.
  • Step 3: Write a compiler for your favorite language in L
  • Step 4: Write a major project idiomatically in L
  • Bonus: Make sure the result of Step 2 is compatible with the result of Step 4.

That should pretty much cover it, get back to us with a progress report in 10 years.

If all you're after is learning to do web development, and you already know Perl and Python, you pretty much have enough for a start. I'd say start learning the ins and outs of Apache (and specifically mod_perl and mod_python), then get practicing. Maybe pick up a book or two on CGI programming, network communication and such, rather than specific language manuals.

As a final note, being a beginner is no reason not to learn Lisp. Go check out SICP and the video lectures. Neither assumes any level of expertise with development, or computers. In fact to quote the introduction to the video lectures

I'd like to welcome you to this course on Computer Science. [Writes it on the board] Actually that's a terrible way to start. Computer science is a terrible name for this business. First of all, it's not a science [crosses out "science"]. It might be engineering or it might be art. [...] It's also not really very much about computers [crosses out "computer"]. And it's not about computers in the same sense that physics is not really about particle accelerators. And biology is not really about microscopes and petri dishes. -Hal Abelson

Inaimathi
  • 4,884
  • 1
  • 26
  • 34
-2

Best way is to learn basics/fundamentals of a programming language and then join a company as a junior developer (contractor). This will be the fastest way to learn and make money as well for your time ;)

-2

I don't want to say much except two steps.

  1. Learn Data Structure
  2. Learn The Introduction to Algorithm

P.S. Programming is your daily task.

Martijn Pieters
  • 14,499
  • 10
  • 57
  • 58
  • On Programmers you are encouraged to "say much", don't be shy :) Give some details on your advices, like ressources, references or examples from your own experiences. – Matthieu Dec 07 '11 at 13:56