From Object-oriented_programming#Criticism

> The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle

or

> Furthermore, he cites an instance of a Java professor whose "idiomatic" solution to a problem was to create six new classes, rather than to simply use a lookup table.

Classes are templates defining behavior (methods) for object instances belonging to that "type". The "constructed" objects are usually restricted to hold data (attributes).

Sometimes you just need flexible objects having a variety of behaviors which can't be easily typed.

For instance (let's objectify a $woman ;-) ...

metaphor

I always say: My father is German and my mother is complicated.

The truth is she has three passports, a college degree from a 4th country and speaks 3+ languages. I.e. I can't "type" her anymore.

So I'd rather avoid this discussion, before my food gets cold. And it's annoying to finally point out that people don't have the necessary background to understand. (that is their (stereo)type system sucks)

So creating a singleton "class" for every combination of attributes and functions an object could have is expensive, especially in Perl where you have to represent classes in a global hierarchy::of::packages

It's easier to add methods to an object without the need of typing.

Self or JS are classless, a JS object inherits from another JS object.

But that's also bit one dimensional. *

There are good reasons for OOP like encapsulation or polymorphism, but you could easily be trapped in design hell if you have to maintain an overly complicated class hierarchy, especially because people often can't even agree on the terminology.

another quote:

> Paul Graham has suggested that OOP's popularity within large companies is due to "large (and frequently changing) groups of mediocre programmers". According to Graham, the discipline imposed by OOP prevents any one programmer from "doing too much damage"

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

update

*) you can also add methods on the fly to an object in JS. object.my_sub = function (...) { ... this.bla ...};

°) Well, she may be a class of her own but she's not my type.


In reply to Re: Role::Tiny: When to use apply_roles_to_object? by LanX
in thread Role::Tiny: When to use apply_roles_to_object? by karlgoethebier

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.