Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Difference between Function-oriented and object-oriented in Perl

by GrandFather (Sage)
on Nov 23, 2007 at 06:25 UTC ( #652506=note: print w/replies, xml ) Need Help??

in reply to Difference between Function-oriented and object-oriented in Perl

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
  • Comment on Re: Difference between Function-oriented and object-oriented in Perl

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652506]
[Corion]: Meh, first round of escalations for me not wanting to fix in production what a project has mismanaged. Now another project, which eats up all the resources until end of this year wants to take that task and put it on my list of things as well.
[Corion]: So now there will be the fun of me explaining to the project that $other_project had low priority because $project has high priority. If $project picks up the task from $other_project, they also will need to reprioritize my tasks to get that done...
[Corion]: ... of course at the cost of something else on my list of tasks for $project, as there only is a finite amount of days until $deadline.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-08-17 12:24 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (287 votes). Check out past polls.