Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to start. || Ramblings of a confused mind.

by radiantmatrix (Parson)
on Jun 09, 2005 at 15:37 UTC ( [id://465182]=note: print w/replies, xml ) Need Help??


in reply to How to start. || Ramblings of a confused mind.

Writing code is, in many ways, no different than writing prose. The best piece of advice I ever got in both cases is ot just start writing. Remember, in both prose and code, writing is an iterative process. You'll rewrite things -- maybe even several times -- before you get them the way you want them.

Also, the first few things everyone writes are crap. That's ok. Write crap that no one else needs to use, but that helps you; I cut my teeth writing horrible little automation scripts to handle some thing on my home Linux machine. They are embarrassing now, but I learned a lot by doing them.

Pick a problem, and see how much of it you can solve with the skills you have. Look up what you can't solve on your own, and ask the community for help when you're stuck. Then, go back and try to make it faster, more reliable, etc. Then, refactor into another Way To Do It.

For example: write a script that emulates the basic functions of the UNIX ls command. Now, do it with subroutines of no longer than 10 lines each. Now, split groups of subs out into modules (you might have to learn about modules to do that). Now, make those modules OO instead of exporting. At each point, update your main ls script to use the new system.

Exercises like this tend to teach you a lot, because you can solve a problem you already know a bit about (listing files), and you have a reference for what "correct behaviour" is (the ls command). Revising will make you see where some things are difficult, but more importantly, it will help you see a few different ways to do things, and what some of the tradeoffs are. If you do this with a few simple projects, then you can start on something a little bigger.

And remember, when you're done, it will probably be crap. ;-) That's OK: writing crap is how you get comfortable with writing, and as you get more comfortable, you write better. I've been coding in Perl for several years, and most of what I write is still crap -- but it's less crappy than it was when I started, and someday I might actually write good code. Very few people write truly good code.

Yoda would agree with Perl design: there is no try{}

  • Comment on Re: How to start. || Ramblings of a confused mind.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://465182]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found