Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Inside-Out Object Model

by tomazos (Deacon)
on Nov 05, 2006 at 19:09 UTC ( [id://582328]=perlquestion: print w/replies, xml ) Need Help??

tomazos has asked for the wisdom of the Perl Monks concerning the following question:

What is an Inside-Out Object Model?

Where did it come from, who coined the term?

What are the pros and cons of an Inside-Out Object Model? How does it compare with a non-Inside-Out Object Model?

What are the different ways you can use an Inside-Out Object Model in Perl 5?

What are the different ways you can use an Inside-Out Object Model in Perl 6?

Replies are listed 'Best First'.
Re: Inside-Out Object Model
by xdg (Monsignor) on Nov 05, 2006 at 22:03 UTC
Re: Inside-Out Object Model
by clinton (Priest) on Nov 05, 2006 at 20:48 UTC
Re: Inside-Out Object Model
by ikegami (Patriarch) on Nov 05, 2006 at 19:17 UTC
    Thore are big questions. What have you found out so far? Inside-Out objects have been discussed on Perl Monks before, — use Super Search — there are modules to facilitate their use on CPAN, and I'm sure there are presentations on them on the web.
Re: Inside-Out Object Model
by EvanK (Chaplain) on Nov 05, 2006 at 22:23 UTC
    As well, you may want to get your hands on a copy of Perl Best Practices, as it explains a great deal about inside-out objects, as well as just is generally a good book to have.

    __________
    Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
    - Terry Pratchett

      I agree it's a great book to have, but it actually explains a lot less than the articles I listed above or the talk I gave at YAPC::NA this year. In particular, it does not sufficiently address some of the shortcomings and pitfalls of inside-out objects. It's certainly not where I would suggest anyone go to learn about inside-out objects, though it has increased awareness and sent people to places like Perl Monks in search of details.

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Inside-Out Object Model
by Anonymous Monk on Nov 06, 2006 at 08:47 UTC

    What are the pros and cons of an Inside-Out Object Model?

    Pros:

    • Encapsulation of attributes: only the scope that defines the attributes can get at them.
    • Inheritance always works: the implementation isn't dependent on how a super class is implemented.
    • Multiple inheritance is potentially easier.
    Cons:
    • It's more complex, you need for instance a DESTROY function.
    • By default, they don't work after splitting of threads, unless you set up a special CLONE method. (They should work fine if you only create objects after you've split up your threads).
    • Due to the encapsulation, you will need to do extra work when serializing.
    • There's far less documentation. "Everyone" still gets to learn hash based objects when learning OOP in Perl.
      Object::InsideOut is a full-featured insideout object suport module that handles all the cons mentioned above. It is extensively tested, well-documented and actively supported.

      Remember: There's always one more bug.
Re: Inside-Out Object Model
by sh1tn (Priest) on Nov 05, 2006 at 22:18 UTC
Re: Inside-Out Object Model
by jdporter (Paladin) on Nov 06, 2006 at 03:41 UTC

    Super Search.

    But a list of relevant articles to get you started can be found on my patio.

    We're building the house of the future together.
Re: Inside-Out Object Model
by Anonymous Monk on Nov 06, 2006 at 08:37 UTC

    What are the different ways you can use an Inside-Out Object Model in Perl 6?

    Who cares? None of the problems with traditional, hash based, objects in Perl5 that Inside-Out Objects solve exist in Perl6. So, there's no need for Inside-Out Objects in Perl6.

    In fact, the big problem with objects in Perl5 is that the objects in Perl5 are very minimal - there's no build-in support for object attributes. And that's where the problems come from. Perl6 has build-in support for object attributes, and hence, Inside-Out Objects aren't necessary.

    Of course, if it's indeed true that all perl5 programs work with Perl6, the answer is "exactly the same way as you do in perl5".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://582328]
Approved by ikegami
Front-paged by friedo
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-18 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found