Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

what is the best way to learn to program?

by Anonymous Monk
on Apr 07, 2000 at 17:25 UTC ( #7121=categorized question: print w/replies, xml ) Need Help??
Contributed by Anonymous Monk on Apr 07, 2000 at 17:25 UTC
Q&A  > object-oriented programming


I have allways loved the idea of being able to make my own programs istead of the bug infested ones that other companies make.
I have asked many people and noone will help me.

Answer: what is the best way to learn to program?
contributed by btrott

I agree generally with chromatic's answer, although "just sitting down and programming" could, I think, seem like a relatively daunting task for someone who's never programmed at all. :)

I came in to Perl already quite familiar with C++, so from that perspective I already learned a lot of the basics of programming; the sort of concepts that can apply to any language. If you're not familiar with those, I suspect it's a bit more difficult to just sit down and learn a new language *and* how to program, in general.

I think I'd recommend a beginning programmer's book, such as Elements of Programming with Perl. From there you can learn the basics, and once you've learned those, I agree completely with chromatic: learn new things by finding problems you want to solve, and jump right into solving them. Don't be afraid to look at other code (but try to find good code, not code that hasn't been touched since Perl 4 was in its heyday). One source for good code, I think, is Randal Schwartz's Web Techniques column. Practical, applied uses of Perl. Start with the first few, then work up to the later (more complicated) scripts. The Unix Review columns are good too.

Answer: what is the best way to learn to program?
contributed by chromatic

The way I learned to program was by sitting down and programming. Seriously.

One thing that helped me was typing in a short program from a book or a magazine, and then changing it to add features or do different things. If you start with a well-designed program and keep it up, pretty soon you'll absorb good programming.

That said, there are a couple of good books from O'Reilly and Manning Press that I would recommend. Learning Perl is one, and Elements of Programming with Perl is another. (The latter is my preference, as it teaches both Perl and programming.)

Also, Perl comes with a load of good documentation, available by typing 'perldoc perldoc' right at the command line. You can learn most of the language from there (but much of it assumes you're already fairly familiar with programming in general)

Answer: what is the best way to learn to program?
contributed by little_mistress

I think they both gave very good answers, but there is another thing that you want to think about What do you want to make? Some sort of project. Its onething to have a tool box full of tools, its quite another to have something that you want to make that is within your skill level.

The first thing i made was a multi-user webpage editing system that was modled conceptually after a newspaper with an "owner", "editors", "sections", "staff-writers", etc. It took me months! now i could probably do it in about 3-5 days.

Aside from the technical part, think about what you want to make. Have a goal, a project. Maybe you could write some customized commands for your shell, or some nifty little cgi thingy that gets a random line from the unix fortune program and puts a different one into a webpage for each visitor. Think of something fun, interesting, and useful. Then the actual "learning" part will be simple. Otherwise you just have a hammer and nails and nothing to build.

Answer: what is the best way to learn to program?
contributed by mstone

Start by learning to read code.

One of my cynical canned rants deals with the idea that programmers are people who know how to write, but don't know how to read. When I'm especially grumpy, I say that most programmers don't even know how to write code.. they just engage in partially-directed genetic algorithm development, with the compiler and test code telling them whether the latest random twiddle will work.

You can actually get a lot of value out of retyping a program that somebody else wrote. Just the act of pounding those statements into the keyboard in the correct order gives you space to think about what's going on, and what the original programmer was thinking.

If you keep at it, you'll learn to recognize various concepts, which will give you the basis you need to discover even more. Eventually, you start to recognize personality traits of the programmer who wrote the code.. this one's an optimist, that one's a pessimist, this one builds structure by the numbers, that one lets it evolve like jazz. And as you expose yourself to acres of code written by people who've already developed a style, your own will evolve, almost by osmosis.

Existing code also gives you a starting point where everything works. There are few things more frustrating than slogging through umpty-seven permutations of code because the documentation was written for somebody who already knows how to make everything work. Start with what works, so you can go back and get that little fix of success when you need it. Swear to God, when I'm deep in the guts of some problem that isn't ready to get up and limp yet, I'll write "hello, world." programs to keep myself from going nuts.

And as it happens, Perl comes with a whole library of code that you can read, copy, and play with. Want to understand namespaces? Read Want to understand data structures? Read Want to test the limits of your sanity? Read ;-)

Seriously, read the libaries. I try to go through the whole batch at least once every year. And I learn something new every time.


Answer: what is the best way to learn to program?
contributed by Studdly

Generally, I find that the easiest way of learning a new language, assuming you have at least some programming experience, is to follow these three easy steps:

1. Find a good website (like this one) with tutorials and examples and such.
2. Find a few relatively simple programs, and try to duplicate them.
3. If at all possible, try to find someone (a friend, relative, co-worker, etc.) who can walk you through your first few attempts.

These things seem to work pretty well for me; I hope they help.


Answer: what is the best way to learn to program?
contributed by SoftTerrier

To program, to program and to program... You can wrap into the loop these words.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (3)
    As of 2020-09-29 07:04 GMT
    Find Nodes?
      Voting Booth?
      If at first I donít succeed, I Ö

      Results (146 votes). Check out past polls.