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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.