Yes, exactly. Lots of people miss that, despite the inclusion of encapsulation and inheritance, a lot of OO code is essentially just changing the semantics. This of course is bad OO, and 'good' OO will make some use of the new syntax, rather than just using it as sugar. The basic conversion is (pseudocode, not Perl, not C):

foo($alpha,$beta,$gamma); // into $alpha->foo($beta,$gamma);

These concepts can be used to do pseudo OO in C (a non OO language by all means), whereas many think you need C++. However, you lose the encapsulation so you have to have extreme discipline in that regard (just calling functions and refusing to twiddle structure bits) and you can't leverage inheritance without using function pointers to simulate method lookup tables. It's when you start using function pointers for virtual-ness when it starts to get ugly, very ugly, so you might not have gone there in the first place. Bad!

So, anyway, what I mean to say is that while encapsulation, inheritance, and polymorphism are viewed as basic tenets, the simple idea of "keeping data together" (i.e. C structs or Perl nested datastructures such as an HoH) are perhaps some of the most widely used -- a "non OO" OO. It quickly devolves into basic proceduralism., especially if you have already broken encapsulation with too many trivial getter/setters. Inheritance, too, is widely overused.

What was I saying? Ah yes, as you say, it's just proceduralism by any other name -- but a HECK of a lot cleaner than base proceduralism if you want the same power and safety in your data structures.


In reply to Re: Re: I heart OO by flyingmoose
in thread I heart OO by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.