Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

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

Thanks everybody for your comments. I think this little exersize has finally shown me the most fundamental problem with my approach to coding, that being, that the real coding begins after I get the code to work. My standard approach has always been just to go to the next chunk of code as soon as I have something that achieves the functionality I'm after. Lesson well learned.

The psuedo-hash information alone shows that there needs to be a total re-write. Because of the performance gain I had planned on using the construct as my default OO structure for the majority of my OO projects. Furthermore, I had not considered the construction costs of providing all the accessor methods that may or may not be used. I simply provided them because that's what the book does. (And if Damian, or many of the perlmonks here, said to jump off a cliff, I'd at least give the suggestion serious consideration :)

This is intended to be a universal base class for dice, so that anyone could derive a "Dice::Yahtzee" or "Dice::BarDice", "Dice::DnD", "Dice::Craps" etc.

Storing the value of each di is fundamental to the purpose to the class. That storage is what makes it a 'di' and not just a random integer. However providing an alternative constructor without storage may have value in many situations. Without storage, utilizing the int(Rand( $num)+1) would be the smarter way to go. Providing it would simply give the calling code continuity, but would not be worth the performance hit.

After much meditation I don't believe this is a case of 'over-enginneering'. Di are an object unto themselves that are as old as Egypt, and the patterns derived from thier differing applications of randomness are the key to programming chaos into simulations that make them seem more 'real'. Not to mention the bulk of programmers who would just simply like the 'shortcuts' that the object could provide.

I'm going to keep persuing this here and all the way to CPAN. Why not? It'll probably get more use than Bone::easy. I need to learn POD and the route to publishing on CPAN and this basic class simplifies the learning process on all levels. It has a certain 'Zen' apeal for me.

coreolyn - Heading back to the drawing board.
UPDATE: Look for Dice::di VERSION .04

In reply to Re: Dice::Dice by coreolyn
in thread Dice::Dice by coreolyn

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 making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-24 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found