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