Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: How to implement a Design Pattern/ Strategy??

by chromatic (Archbishop)
on Jun 13, 2011 at 02:54 UTC ( [id://909324]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to implement a Design Pattern/ Strategy??
in thread How to implement a Design Pattern/ Strategy??

I was going to make a subroutine, just wasn't sure if I should put everything in it, or only the parts that were **exactly** the same...

Subroutines are useful for avoiding repetition, but the best thing about subroutines is that they let you extract and name a little bit of behavior. Most of my small, single-file programs start out with me declaring main() and then calling a bunch of smaller subroutines from there. I fill them in as I go, and I use their names to describe what they do.

Log In?
Username:
Password:

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

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

    No recent polls found