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

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

can any one tell how to start out learning a programming language?

Replies are listed 'Best First'.
Re: programming language
by Spenser (Friar) on Dec 19, 2001 at 11:20 UTC

    The best book on the market currently for learning programming in general, in my opinion, happens to use Perl as the basis for teaching programming. That book is Elements of Programming with Perl by Andrew Johson, published by Manning.

    It starts off with basic programming logic without any programming commands.  That is to say it starts off with exercises and examples with just human instructions, but instructions that follow the logic a computer use.  This helps the reader to understand how to communicate with a computer without getting bogged down with learning commands.  Then the book gradually replaces these human instructions with simple Perl commands.  With Perl being a very natural programming language with many English like words that one would use in normal conversation, it makes for a natural transition from human to computer language.  A very clever approach that will give you a basic foundation in computer programming and Perl in a short period of time.

    I will give you one warming about the book, though.  The first three chapters or so are so basic that it can be a little slow moving.  My advice is to force yourself through them because it will pay off.  After the first few chapters, it picks up speed and you can then jump around.  If you skip the foundational chapters, though, you'll soon find yourself confused and frustrated.  So, if you decide to use this book, commit to yourself to endure the first chapters and you'll be glad you did.

Re: programming language
by silent11 (Vicar) on Dec 19, 2001 at 03:57 UTC
    You have come to the right place I have learned much about programming here at PM... Start here with the basics . Good luck!
Re: programming language
by hding (Chaplain) on Dec 19, 2001 at 07:59 UTC

    That's a rather hard question to answer without a little more knowledge about the student's particular goals. Is the student in some other discipline with a desire to know enough about programming? Is he desirous to be a "programmer"? Is he just trying to expand the breadth of his knowledge and has chosen this as a specific way of doing so? Do you mean someone who already knows some computer programming and wants to pick up a different language? All of these may have different answers.

    That said, here's a link to a book/course designed for teaching the general student (not just the computer scientist or programmer) how to program (or perhaps I should say, how to design programs).

      Learning Perl by Randall Shwartz & Tom Phoenix. Not to sound like I'm trying to sell you something (although merlyn might like that); this book is the only reason I remotely understand the language of Perl, that is, only if you're trying to learn Perl :).

        Actually, we really don't mind if you buy things to support the Monastery (or contribute directly). In fact, we strongly encourage it.

        Take, for example: Learning Perl, 3rd Ed. If you buy it through the link, the Monastery gets a tiny kickback via fatbrain's affiliate program.

        Keep the candles burning...

        --f

        P.S. That link was brought to you by your friendly Site FAQ.

        Whilst I agree that Learning Perl is a great book (hey, I've bought all three editions), it doesn't attempt to teach you programming. It assumes that you already know how to program. As someone else has already pointed out, Elements of Programming with Perl is much better suited for this.

        --
        <http://www.dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

Re: programming language
by monk2b (Pilgrim) on Dec 19, 2001 at 05:19 UTC
    This is kind of a loaded question. I don't consider myself
    a programmer by any strech of the imagination, however I do
    frequently write some very basic and useful programs. I started
    with bash and before I was any good started learning perl. I
    consider perl to be my first programming language.

    If you want start learning perl cheaply and IMHO effectively
    There is a website name perltutor.com that I like a lot.
    I feel it is complete and will get you up and programming quickly.

    learning too! Monk2b
Re: programming language
by Anonymous Monk on Dec 19, 2001 at 19:49 UTC
    To answer this question, you'll have to ask yourself another question. What method of learning is most effective for you?

    Some people can learn well from books. If that's the case, your in luck because there is a plethora of books out there that can help you. But if you're not the type to learn just by reading, then you'll need to consider other avenues.

    If you prefer a more interactive form of learning, then you might consider taking an introductory class at a college or university. Or if you'd like something less formal or less expensive, then search for some kind of computer-based training program on CD-ROM or via the internet.

    Or maybe you know someone who already has a programming background. If so, why not ask them to be a tutor/mentor?

    I hope you found this post helpful.

    Jim D> (whose just a Monk wanna-be)

Re: programming language
by hsmyers (Canon) on Dec 19, 2001 at 23:29 UTC
Re: programming language
by Chrisf (Friar) on Dec 19, 2001 at 17:22 UTC
    Learning Perl is definately a great book - if you want to learn perl.

    If you're just starting out, you should probably learn the basics of programming through C or Java first, then move on to perl. This will give you a better understanding of programming in general and will prevent you from losing focus thinking "I could do this in 3 lines of perl." ;-)

Re: programming language
by archen (Pilgrim) on Dec 19, 2001 at 07:11 UTC
    The short answer is: find a book. I could recommend a Perl book or two, but I feel that Perl isn't a good language to start with. You might be better off learning Java or C++ to begin with. Both are good langauges to get into the concepts of programming. Eventually I learned Perl because it's extremely powerful, useful, and when it comes to cgi programming, that's all my web server supports. Maybe a better question would be, what do I want to do? And which programming language would let me start solving real problems?
      Perl is the best language if you need a powerful solution RIGHT NOW. Java is a good if you have the time to learn a lot of fundamentals before you can start writing useful things on your server.

      -oakbox

Re: programming language
by NotJeff (Beadle) on Dec 20, 2001 at 01:16 UTC
    I think I'll be a heretic myself. For _most people_, I would think, the best way to learn their FIRST programming language is by taking a class. Learning further programming languages can be done from a book with more reasonable efficiency, I think. In any event, if you ARE going to take programming classes of any sort, I would recommend the following:

    If you want to take 1 class, take it in a language which does NOT explicitly support Object Oriented. Perhaps C.
    If you are willing to take two classes, add a class in Object Oriented Programming of some flavor, Java or C++ perhaps.
    If you are willing to take a third class, add a class in Data structures.

    I happen to have taken only 3 CS classes while I was in high-school/undergrad: C Programming, Java Programming, and Data Structures. The only thing I feel I'm missing that I should have taken that would be useful to me now is a class in Algorithms, or specifically in combinatorial optimization.

    Your mileage will vary. I do biophysics, and those are the bits of programming which are useful to me and sufficient to allow me to read up on any new programming element or language I need to.
Re: programming language
by mrbbking (Hermit) on Dec 20, 2001 at 06:57 UTC
    I recommend that you identify the language you plan to use, and learn that one. Other posts have given good suggestions for particular languages.

    The mistake I made early on was to try too hard to follow a college-like path. That is, learn Pascal, because it was designed to be a teaching language. Then learn C, because it's the basis for many other languages, then learn C++, because it's object-oriented, and based on C...

    I lost interest in Pascal pretty quickly, because I knew I'd never use it after learning it. C was very intimidating at first, and difficult for me to find "useful" things to do so I could see quick progress. I'm the kind of person who wants quick feedback early on, to be sure I'm on the right track.

    ### Begin Subtle Perl Plug ###
    Perl has been great for me because it works at a lot of different levels. In Programming Perl, it's explained in terms of a natural language. A child can communicate using a subset of his native language, even imperfectly. That's true with Perl, too. You don't have to get it all perfect before you start seeing results. Quick feedback facilitates learning.
    ### End Subtle Perl Plug ###

    So, choose the language you want to use - have what you consider to be a Good Reason for choosing that language - and stick with it. Expect to have rough spots, and expect to have to think!



    Best of luck to you! Update: Here's the Natural Language thing I was talking about.
      I recommend that you identify the language you plan to use, and learn that one. Other posts have given good suggestions for particular languages.

      That kind of turns the question into a chicken-and-egg problem, doesn't it?

      To learn "pure" programming, Perl itself may not be the best choice since:

      • It permits (and has been known to accidentally work correctly in the face of) major typographical and syntactical errors. This lets one off the hook for what I can only describe as being the, "I did everything right and it still won't ... (compile, run, work, etc.)" class of beginner programming errors -- IMHO, there's no way to become a programmer without experiencing this more times than I care to remember. Of course, these must eventually be resolved with what I think of as "Aha!" moments.
      • Loosely, T M T O W T D I (There's more than one way to do it). When learning, it can be confusing finding out that what you thought was the "right way" to do something is merely one of several ways that work, and, in fact, does what you want by accident or as a side effect (to wit, assigning an array element with the all-too-often seen, @array[0] = 'something').
      • Examples of "bad" perl programming currently permeate the web. That they happen to work doesn't necessarily mean that they should be emulated. Witness the discussion on PerlMonks about Matt's Script Archive.

      At the risk of inviting the wrath of the gods, I'd recommend starting with one of the IDE-based english-like languages (VB comes to mind) just to get a handle on concepts like loops, if-then-else logic and the like, and THEN move up (notice I said "up") to Perl.

      dmm

      You can give a man a fish and feed him for a day ...
      Or, you can
      teach him to fish and feed him for a lifetime
        That kind of turns the question into a chicken-and-egg problem, doesn't it?

        I think it's a chicken and egg problem to begin with...

        And I'm not sure how a beginner would get around that. I certainly didn't...

        Maybe it's necessary to spend some time with "the wrong language" in order to learn why it's not the one for you. In my case, it didn't take much Pascal for me to realize I didn't want to continue with it. It was too formal for my tastes. I like Perl's informality.

        To learn "pure" programming, Perl itself may not be the best choice...

        I think you're right. If you want to learn "pure" programming, Perl does way too much for you, behind the scenes. For that sort of thing, maybe the Assember to C to C++ path makes more sense. But I'm getting over my head, here - I don't have deep experience with any of those three, so I could be off base...

        As usual, the answer to this question depends on the answer to the question, "What's your goal?" There are any number of paths, but they don't all lead to the same place.
        That's is a good thing.

Re: programming language
by UNverKnow (Initiate) on Dec 19, 2001 at 23:09 UTC
    The best way to learn has been for me to find a language that solves a (not too big) problem that niggles you. My problem was reconciling files with different formats and complicate mappings. Hence Perl. Now if your problem is to create a GUI front end for a MacOs app, then there might be better choices.... A tip: choose a language looks like it can solve your next 2/3 niggling issues or else it get frustrating....
Re: programming language
by staeryatz (Monk) on Dec 20, 2001 at 06:57 UTC
    Here's a site which has sections on many, many languages. For each language the section will have links to resources, tutorials, books, downloads, and other programming websites.

    http://code.box.sk

    IMHO a good first language for someone to learn is 'C'.

    As NotJeff mentioned, it can be good to take a programming course. But that really depends on how they go about teaching it. If the instructor tells you to go buy a book and read the chapters, and gives you assignments right out of the textbook, then you're better off without it.
Re: programming language
by ellem (Hermit) on Dec 20, 2001 at 19:57 UTC
    First and foremost you need to decide what you _need_ to do. You can buy hundreds of books, go to thousands of courses and never learn a thing.

    In Learning Perl 3 RS says something along the lines of "Perl isn't a good language to learn with if you aren't going to use it everyday." (I don't have my copy handy.)

    This is the truth. You need to be active with your language of choice. I used "The Elements of Programming With Perl - Andrew Johnson" to learn the rudiments of programming.

    But I chose Perl because as a Sys Admin it made the most sense to use Perl. Now as I further my programming skills I have begun to learn Java with "Thinking In Java (2nd Ed) -- Bruce Eckel" which isn't going nearly as well simply because I don't have a real _need_ for Java at the moment. (And because I think in Perl... much to the chagrin of my programmer friends!)

    But you've come here so I assume you want to learn Perl. Now just figure out why and it will all fall into place. Think of programming as another language (which it is.) Would you ever learn French because you thought it would be a good job? Until you _need_ to learn French you probably won't. So if you are lost in France you _need_ to learn French. Along the same lines if you _need_ to read a 120,000 page log file looking for rm -f, you'll learn Perl.
    --
    lmoran@wtsg.com
    There's more than one way to do it, just don't use my way.
Re: programming language
by Steve_p (Priest) on Dec 21, 2001 at 01:24 UTC
    Guessing by the question, I'm assuming your a first-time programmer. I've always thought that the worst way to start learning a programming languange was to sit down and learn the syntax. If you are new to programming, the quickest way to get started is think about you program in terms of problem you want to solve with a computer. For example, "I want to create an web page that writes out my name." Start simple and work from there. Start with working out in your head what you want the program to do step by step. You may do this several time starting fairly generic, but getting more specific on what you want it to do. Then, start going through books, web pages, etc. to learn how to write the program in the language you want to learn. Not wanting to start a flame war, but any languange is perfect for being your first language.

    Daring to go off topic, I don't believe that your choice for the first programming language you learn is at all important. I started with Basic and Assembly on a Commodore 64. What is important is learning how to solve your problems in a step by step manner. A book I recently read that does a good job of this is How To Design Programs. It teaches programming by using this approach.

    Yes, it uses Scheme, but still, learning a specific language is not important, becoming a skilled programmer is. After you learn how to program, learning languages is very easy.
Re: programming language
by Anonymous Monk on Dec 20, 2001 at 04:12 UTC
    First of all, get the book "Think Unix" by Jon Lasser. Then Get Mandrake Linux or some other easy to install Linux. Install Linux, play with it, read and absorb that book.

    Then get "Learning Perl" published by O'Reilly. Its a great book that is well paced clearly written. If you do all of this, you will become a programmer.

    Its that simple.

Re: programming language
by astaines (Curate) on Dec 20, 2001 at 16:13 UTC

    I learnt how to program from two books, both by Donald Alcock 'Illustrating Basic' and 'Illustrating C'. These are both hand written and hand ilustrated, and explain very well what's going on in a program.

    I agree with Spenser very strongly. You first have to learn to program - that is to learn how computers 'think'. Trying to learn a language without learning what can be said in it is probably futile. How computers operate is very different to how natural languages operate.

    Fatbrain has most of Alcock's books in stock

    -- Anthony Staines
Re: programming language
by mr_mischief (Monsignor) on Dec 21, 2001 at 01:56 UTC
    It's good to take a look at someone else's code in the language you want to learn. The caveat here is that you could learn bad habits from the person who wrote the code. There's one person in particular (whom I won't name, but most of the monks know who I'm mentioning) who has damaged a bunch of budding Perl programmers' beginning attempts. A book that comes with ample examples, therefore, is a good idea, because the author generally knows how to do things correctly.

    In the case of Perl, O'Reilly has a _Perl CD Bookshelf_ which is pricey but which contains searchable text of a number of books on Perl. _Learning Perl_ has good examples, too. The book doesn't come with a CD last I noticed, but one of the authors, Randal Schwartz, has a whole site full of handy examples on his company site at http://www.stonehenge.com. Undoubtably some of the other books people have mentioned have examples in some electronic form in one place or another.

    I'm a firm believer that changing working code line by line to see what breaks and what useful working changes you can make to it is a good way to learn. I feel this is true no matter the language.