Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Answer: what is the best way to learn to program?

( #132765=categorized answer: print w/ replies, xml ) Need Help??

Q&A > object-oriented programming > 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 Exporter.pm. Want to understand data structures? Read Symbol.pm. Want to test the limits of your sanity? Read CGI.pm. ;-)

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

mike
.

Comment on Answer: what is the best way to learn to program?
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-04-20 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls