http://www.perlmonks.org?node_id=25786

NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
RE: Learning Programming
by mwp (Hermit) on Aug 02, 2000 at 22:02 UTC

    I'd just like to clarify your question.What's the best way to learn additional programming languages? or What's the best way to get started with programming?

    Having taught several people how to program and learning a multitude of languages on my own time, I feel that I speak from experience when I say that a programmer's mindset is unlike anything in the world. Including engineering, the natural sciences, even other fields of computer science. If you're asking the latter question, then my advice to you is as follows: Develop the mindset first!

    • Learn Boolean algebra
      The simplest way to understanding conditional expressions is the most direct way--return to the source. Basic Boolean algebra will cover AND, OR, and NOT, condition groupings, changing from NOT AND to OR expressions, etc. If you're really curious, you can even go on to read about XOR and XNOR. If you go that far, you may even want to learn about Boolean truth tables, in which we analyze the input and output values of a "function" (traditionally a circuit, but applies here too).
    • Start with a simple language
      I've taken to calling beginning languages "gateway" languages. Just like gateway drugs, and--depending on how hooked you become on programming--probably just as detrimental to your health. :-) If you start with Visual Basic, or JavaScript, or even Perl, you can learn the basics of programming (flow control) without worrying about complicated syntax or confusing runtime errors.
    • Design a small project for yourself
      One of the things I've learned during my time in this industry is that the potential for learning is much greater when you have a deadline! While I wouldn't exactly take it that far, you can most certainly come up with an idea for a program you would like to write, and set time-oriented goals for yourself. Some of my earliest programs included a batch-file and QBASIC system maintenance tool, and another QBASIC program that cataloged information about our neighboring star systems (for quick reference in Sierra's Outpost :)

    Some of the things I would recommend against are:
    • Learning a new operating system concurrently
      (like Perl and Linux)
    • Learning more than one language at a time
      (like HTML and JavaScript)
    • Learning out of a book
      I've found that many of the techniques and functions you learn out of books have little-or-no real-world application. The Camel books for Perl are pretty good, as is anything by O'Reily and our friend merlyn. But be wary of book titles like "Mastering C++ in 24 Hours". It just simply can't be done.

    If, however, you're interested in expanding your horizons and learning an additional programming language, then I would definitely use some of the items from the above list. Design a program you want to write. Pickup a book to use as a reference. Find a decent group of people you can ask questions (like us :). But most importantly, ENJOY YOURSELF!

    Good luck, young Jedi.

    Alakaboo
    I am the lurker that spams in the night.

RE: Learning Programming
by BlaisePascal (Monk) on Aug 02, 2000 at 22:14 UTC
    Learning programming and learning programming languages are two completely different things. But for both, study and practice (and practice and practice) are usually the best ways.

    To learn how to program:

    Pick any good programming language (perl, scheme, C, logo, smalltalk, etc) and a good intro book on programming (preferrably one not tied to a particular language) and start playing with the language while working through the book. Work on things that interest you, etc. The language will give you experience, showing you what really happens, and the book will give you some theory to back that experience.

    Once you are comfortable doing some programming, switch to a different language -- preferrably something much different, like C if you started with scheme, ML if you started with perl, tcl if you started with ADA, etc. Then start working through some of what you did earlier in the new language.

    Languages differ in more than just syntax. Languages differ in style, differ in vocabulary, and differ in how they encourage you to get things done. Learning more than one programming language (and being moderately fluent in it) really helps you be a well-rounded programmer.

    Once you've worked through the intro book, go with a heftier, intermediate book -- like Sedgewick's "Algorithms", or Knuths "Art of Computer Programming", or the big white algorithms book from MIT Press (book is at home, so I can't read the authors). Read through those books, learning about things like "Big-O" notation, divide-and-conquer, dynamic programming, and other ideas and techniques that will help turn you from a good programmer into a great one.

    Does that help?

    As for learning a language itself... Get a manual and start playing. Do simple stuff first, until you get comfortable with that, then expand your skills with your comfort level. And definately read other people's code in that language. Languages have distict syntax&grammar, vocabulary, idiom, and thought-processes. When you start learning, say, perl, you will have to learn first the syntax and grammar, the vocabulary will come to you as you work with the language (but you may still be looking details up years later). Once you start using and understanding idiom (which will take experience in the language), you are well on your way to thinking in that language.

    And then learn another language. The experience will change how you think about programming, and it will change how you program in -both- languages for the better.

    Just my thoughts.

How to learn Programming
by gryng (Hermit) on Aug 02, 2000 at 21:33 UTC
    Hiya,

    It's a tad open ended question. If I had to do it over again right now, I would start by buying a Oreilly book, such as Learning Perl or Learning Python. Since I haven't gotten my hands very dirty with Python yet, and because perlmonks.org exists, I would suggest picking up Learning Perl book :) . Then read it, twice or three times, and then jump in.... (preferably with something small to begin with).

    Ciao,
    Gryn

      I'd suggest jumping in -while- reading it the first time, don't wait until the third reading. Even so, you'll pick up things on the third reading you didn't quite get the first two times.
        Well, I guess it's a difference of opinion, but I would test my patience and read as much as I could before starting in on it. While it may not help your memory to have to simply absorb everything at once, I think it's more important to have a larger base and understanding of the language before trying to use it.

        How many times have you started in on a language (even now in perl) and had solved a problem long ago in some way (perhaps cleverly, perhaps copaciously) only to find in some reference text later, or on a site like perlmonks.org the "correct" way to do it?

        I just think it would be better to fill your cup up before drinking from it, rather than to pour in a few drops, sip a few drops, repeat.

        (But respectfully noting your view)

        Cheers,
        Gryn

      I would probably start off by installing a Linux box. With a normal install of linux you should have most(Minus VB) of the compilers and interperters that a programmer needs. Then decide which language you would like to learn.

      I would suggest a more restrictive language at first. It will make your programs flow better and give you a better understanding of what perl is actually doing for you. This also will show you why so much of us love perl. A more stuctured language like C will also give you good code formatting skills. A compiled language like C will also give you DEBUGGING Skills (which one of my Profs at GVSU says the CS classes are missing now).

      But if you want to dive into PERL get a linux box up and a copy of Learning PERL and read it. Then try the stuff in it. Then get the Perl Cookbook. Then read it.

      --BigJoe

      Learn patience, you must.
      For a Perl Monk craves not these things.
        I want to start this post out with an "ommmmm". That's right clear your monkish spirit and relax.

        Now, we all agree that there are two parts to programming, that which is the language, and that which is beyond the language -- what you created, a part of you, and thus a mirror, and so, a problem solver.

        They key to becoming a programmer is to become a problem solver, and impart that skill into your programs and thus breath into them life.

        However, it would be easy to say that the programming language is not important, a mask or sheet that covers up the true nature of the problem solver you create -- something that hinders and hides your efforts.

        It is so that the language is a mere contrievance and hinders the unwary.

        But it is also so that each language has in itself it's own beauty, like a well adorned mask, that in some ways enhances what is behind rather than hide it.

        Therefore the choice of your programming language shapes the nature of your problem solver. Unstructured languages lend to the programmer power like the water fall and bee-hive. Structured languages lend to the programmer power like the great thinkers and craftsmen.

        And for those that start off, it may be dangerous to use the untamed power of the unstructured language, but it offers them a kind of greed that lets them further the developement of the problem solver.

        But for those that start off with structured languages a greater discipline and drive is needed, because the power of control requires more energy to develop as great of works as the unstructured languages which lend the power of titans to the initiate.

        And return to the center, breath out,
        Gryn

RE: Learning Programming
by meonkeys (Chaplain) on Aug 03, 2000 at 01:17 UTC
    Would the more experienced monks recommend studying Perl Formats in detail?

    I'm currently going through Learning Perl for the second time, and I still want to skip anything about Formats, mainly because I've never seen my mentors use it.

      I would definitely recommend taking a look. Formats are the kind of thing you learn how to do once, then go back and look it up in a reference manual when you need it six months later. :-) Write formats are good for plain text reports, nice debugging output, log files, that sort of thing.

      The reason you probably haven't seen much of it around here, or around other "mentors", is because pretty much anything fancier than "*** SQL: warning, could not prepare statement" is usually a good candidate for Tk, X/HTML, or something along those lines. Knowhutimean?

      Alakaboo