Other monks have commented about OOish code being reusable. This is a myth. Or at least, it's a myth that it is any more reusable than non-OO code. For example, look at the standard C library. It's used by everything you ever write in perl, and yet not OO. Or look at any of the hundreds of modules on CPAN which just provide some useful functions but with no OO stuff, such as
Data::Compare,
Language::Functional and
Net::CIDR. Perl's OO doesn't even easily give you one of the other big wins often touted for OO.
Where OO is helpful is that working with objects instead of home-grown complex data structures provides a useful layer of abstraction that lets us hide complexity from ourselves, so we have to maintain less state information in our poor little branes. That benefit alone makes it worth using.
As for your two questions - the answer to the second is simplest. It's "no". And the reason is the answer to the first - I write OO code when I feel that it helps me solve the problem best, which I suppose is a bit wishy-washy. Sorry.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.