in reply to Right job for the tool.
When would you use OOPerl?
If the module/library needs to retain state, then OO is the natural way to provide for that.
However...
When would you use OO Perl?
Only if the module/library needs to retain state, and, performance is not a consideration for that module/library.
If performance is a consideration, and the functional requirements are such that moving (the critical parts) to C or C++ would be laborious relative to a native Perl implementation; then I will eschew OO and go with a procedural design, manually passing a 'handle' (aka: a dynamically allocated memory address), returned by the 'initialisation' function, to subsequent calls to allow internal state to be retained .
In all coding, in all languages, the functional requirements should drive the design semantics; not the other way around.
OO for its own sake is as destructive as any other dogma.
|
|---|