Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Procedural vs OOP modules

by stevieb (Canon)
on Oct 29, 2021 at 00:23 UTC ( #11138161=note: print w/replies, xml ) Need Help??

in reply to Procedural vs OOP modules

I'm totally on board with what choroba said.

If state needs to be shared between methods or even modules/classes, and/or you want to store an object of a different class in an object so you can make calls on it through the main object (eg. $computer_obj->video_card_obj->display();, OOP works (my RPi::WiringPi is a good example of that example, almost literally).

If no state needs kept, no magic between objects needs to happen, and your subroutine naming conventions won't likely clash with already-imported functions, procedural is the way to go (eg. Bit::Manip).

Other times, I've provided both a functional and object oriented interface within the same module for the same subroutines (eg: WiringPi::API).

Personally, the vast majority of the code I write keeps state, so I'd go as far as to guess that 90%+ of the 55 CPAN distributions I've published are OOP.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-01-18 17:56 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (53 votes). Check out past polls.