Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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{}


In reply to Re: How to start. || Ramblings of a confused mind. by radiantmatrix
in thread How to start. || Ramblings of a confused mind. by jkva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

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

    No recent polls found