Yes, I realize that.

The example given was using object methods as an interface to an object that encapsulated an array with a statistical attribute.

My point was that, for the programmer using this module, it might be more familiar ground for the object to look and feel (from the outside) just like a plain old array. In my example, there isn't a new API to learn. And code using the object will look and feel pretty basic. A Perl programmer plays with arrays all the time. We're all pretty much used to the "interface" to arrays. In this case, the simple (for the programmer utilizing the module) approach is to carry that idiom forward seemlessly, or transparently for simplicity's sake. The only thing to learn would be what object method to use in accessing the array's statistical attribute.

Yes, nothing has really changed internally. But externally, the module's user only has to remember how to play with an array.

But this is all a big tangent on the OP's thread. I have to agree with the OP that the complexities of a datastructure are often better dealt with through layers of objects. However, I don't entirely agree. The objects should be used to simplify life, not to make it more intricate. Occasionally a complex data structure provides simplification rather than undue difficulty. It's not always bad to let the cat out of the bag.


Dave


In reply to Re: Re: Re: Re: Re: multi-tier collections & lack of modulization/OO by davido
in thread multi-tier collections & lack of modulization/OO by pg

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.