Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Procedural vs OOP modules

by Tux (Canon)
on Oct 29, 2021 at 14:06 UTC ( [id://11138213]=note: print w/replies, xml ) Need Help??


in reply to Procedural vs OOP modules

Another criterion might be the environment you are using this new module in: if it is DBI, it is very likely your modules would be easier to write and use using OO. If it is a subclass on something that is purely procedural, OO might be overkill and less intuitive.

You can have modules that be both. Transparantly, and have the end users choose what API they prefer.

So my advice would be to write your module in the way you are most comfortable with and then add the alternate interface later.

(of course if all the good advice you already recieved did not already convince you procedural or OO is better for what you are writing).

I once wrote Spreadsheet::Read purely functional, and added the OO interface later as a proof of concept. That new OO interface was so much easier to work with (for me) that I switched almost completely for my own scripts, but the old(er) scripts still work.


Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138213]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-03-28 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found