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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|