Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Object oriented interfaces to a module are useful where it is useful (or essential) to retain some state between calls into the module.

Functional interfaces to modules are useful where a simple interface is desired and no state need be retained between calls into the module.

Some modules provide both interface modes. List::Compare and List::Compare::Functional provide OO and Functional access to the same set of facilities. If you want to compare the same set of values in various ways the OO interface has a large advantage because a lot of preliminary work gets done only once. If you want to only compare the values in one way there is a slight advantage in terms of coding in using the functional interface.

With Functional interfaces you generally have to option of polluting your name space with all the functions the module provides, or you have to remember to explicitly import the functions you require. With an OO interface you don't need to import any additional symbols into your name space at all.

Generally if there is an OO interface available you are better to use it just because you avoid problems with importing symbols and potential ambiguities over how a particular symbol may be resolved.

Perl is environmentally friendly - it saves trees

In reply to Re: Difference between Function-oriented and object-oriented in Perl by GrandFather
in thread Difference between Function-oriented and object-oriented in Perl by jesuashok

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (7)
    As of 2018-04-25 11:15 GMT
    Find Nodes?
      Voting Booth?