Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Seeking inside-out object implementations

by Perl Mouse (Chaplain)
on Dec 06, 2005 at 23:55 UTC ( #514681=note: print w/ replies, xml ) Need Help??


in reply to Re: Seeking inside-out object implementations
in thread Seeking inside-out object implementations

The second is that Class::Std and some of the others do some things that I don't trust to work reliably and not interfere with some other tool.
Interesting. If Class::Std or "some of the others" interfere with some other tool, why do you blame Class::Std and some of the others, and not the other tool?
And finally, I don't use them because, despite the name, they are the exact opposite of standard. All the Perl literature teaches programmers how simple hash-based objects work, and any OO Perl programmer can be expected to know it and read that code.
First of all, "inside-out objects" as a name doesn't suggest anything about being standard or not. And if your argument makes sense, we'd still be using the indirect object notation, because that's how we used to teach programmers in the literature. Views change over time, and documentation isn't static.
Encapsulation? I'm giving them the source!
The point of encapsulation is that you don't need to read the source.

I guess you don't bother to use strict, or lexical variables, either, do you? Why would you, you have the source!

Perl --((8:>*


Comment on Re^2: Seeking inside-out object implementations
Re^3: Seeking inside-out object implementations
by xdg (Monsignor) on Dec 07, 2005 at 00:28 UTC
    First of all, "inside-out objects" as a name doesn't suggest anything about being standard or not.

    This is, unfortunately, a Damian-created issue, with a number of new modules released to CPAN with "::Std" as part of their names, coincident with the release of Perl Best Practices. "Class::Std" should not be read as "Class::Standard" as it's anything but. Pronouncing that suffix letter-by-letter gives a better sense of the caution and prophylaxis that should be considered before using it.

    -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^3: Seeking inside-out object implementations
by perrin (Chancellor) on Dec 07, 2005 at 17:42 UTC
    If Class::Std or "some of the others" interfere with some other tool, why do you blame Class::Std and some of the others, and not the other tool?

    Have you looked at how Class::Std is implemented? It's pretty crazy. It includes some "worst practices" too, like use of the UNIVERSAL:: namespace.

    "inside-out objects" as a name doesn't suggest anything about being standard

    The name is Class::Std, i.e. "Class Standard."

    we'd still be using the indirect object notation, because that's how we used to teach programmers in the literature. Views change over time, and documentation isn't static.

    If Class::Std ever became a very common way to do things, to the point where the Perl man pages used it in their OO examples, I would drop this objection. I think the difference between Class::Std and normal OO perl is a lot bigger than these other examples you gave though.

    we'd still be using the indirect object notation, because that's how we used to teach programmers in the literature. Views change over time, and documentation isn't static.

    You're misunderstanding me. What I'm saying is that any attempt to enforce encapsulation is ultimately futile when the other person has the source and can simply change your code to expose things that they want. I will grant that it's much harder to do than it is with simple hash-based objects though.

    UPDATE: Class::Std does not actually put things in UNIVERSAL::. This technique is suggested in the inside-out objects section of the PBP book, but not used in Class::Std.

      What I'm saying is that any attempt to enforce encapsulation is ultimately futile when the other person has the source and can simply change your code to expose things that they want.
      You are completely missing the point of inside-out objects. The point of inside-out object isn't to prevent accessing data. The point of inside-out objects is on the one hand to prevent accidental access of data (collisions), and on the other hand to give you compile time errors when making typos in the attribute names.

      Inside-out objects is to OO programming what 'use strict', lexical variables, and name-spaces are to non-OO Perl programming. None of it prevents anyone from getting to anything one wants - but that doesn't mean 'use strict', lexical variables and name-spaces aren't very good ideas.

      Perl --((8:>*
      "inside-out objects" as a name doesn't suggest anything about being standard
      The name is Class::Std, i.e. "Class Standard.
      Let me recall what you wrote:
      And finally, I don't use them because, despite the name, they are the exact opposite of standard.
      That's plural. The thread is named Seeking inside-out object implementations. If your objection is about the name of a single module, then the use of plural is misleading. It would also mean that that objection doesn't hold for different implementations of inside-out objects.

      Unless you want to claim that the name of inside-out objects is "Class::Std". In which case you are utterly wrong. "Class::Std" is a way of implementing inside-out objects, not 'the way'. Dismissing inside-out objects based on a single module is like dismissing databases because you don't like MySQL, or dismissing cars because you don't like Fords.

      Perl --((8:>*

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://514681]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2014-08-22 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (150 votes), past polls