http://www.perlmonks.org?node_id=508880


in reply to Coding styles: OOP vs. Subs

I think there's really two things (maybe three) things going on here. First. there's preferring methods and classes over subs. Second, there's a willingness to use CPAN and not reinvent the wheel. And third, there's setting coding standards at work.

For #1, not sure I can really help you. OOP is not suitable for every task, and lots of people think it tends to be overused (or at least used when not really appropriate). There is a performance hit, and extra coding overhead for going OOP, though on the other hand this is often made up by simplifying maintenance. You say to-MAY-to, I say to-MAH-to. Different strokes for different folks and all that.

For #2, that's a bit more serious. Most of the CPAN modules are OO because it provides encapsulation and a defined interface, and that's all a good thing. I can't imagine someone avoiding the "OO style" so strenuously that they would avoid the CPAN. That's just not smart.

Lastly, it's common practice to enforce coding practices at work, and establish policies and such. If your OO code is the standard code that's supposed to be used at your business, then that's what's supposed to be done. Creating multiple competing solutions that perform the same function is not good business, and if you can't enforce uniformity at this you should find someone higher up your food chain that can.

Bottom line is we're not really talking about OO versus non-OO. He's totally within his rights to prefer one style over another, but work is a whole different matter.

Gary Blackburn
Trained Killer