develooper Front page | perl.module-authors | Postings from November 2003

Re: Class::FakeAttributes -- Opinions Wanted

Thread Previous | Thread Next
From:
Smylers
Date:
November 2, 2003 09:04
Subject:
Re: Class::FakeAttributes -- Opinions Wanted
Message ID:
slrnbqa8e6.pi.Smylers@stripey.com
A. Pagaltzis writes:

> * Smylers <Smylers@stripey.com> [2003-10-31 10:55]:
> 
> >   http://search.cpan.org/perldoc?Class::FakeAttributes
> 
> This has been invented by Abigail quite a while ago and is called
> "inside out objects". See
> http://www.perlmonks.org/index.pl?node_id=219378

Thanks for that.  Knowing that Abigail has used this technique gives me
confidence that it works!

However, even now I know the name for the technique I don't think it'd
be appropriate to call the module Class::InsideOutAttributes (or
similar), because that is describing the module's implementation rather
than the situation in which it is useful.

> There was some discussion on writing a Class::MethodMaker-ish module
> for this technique on PerlMonks, but it's very hard with the common
> state of Perl affairs.

I've never used Class::MethodMaker but it looks to be for helping you
create a class that needs lots of get_*() and set_*() methods to exist
for use by people creating objects in the class to get and set
particular attributes without needing to know how it is implemented.

Class::FakeAttributes helps in a different situation, where a class
author is subclassing something that is based on, for example, a scalar
ref but he/she wants to add instance data in the subclass.  The methods
in this class are intended to help the subclass author access the
attributes inside the class definition, not to provide public methods
for use by the people creating objects of that class.

> I don't really think it merits a module that can't do about as much as
> C::MM.

I don't think it's a case of not doing as much as, but of doing
something different.  Many of my classes don't have get_*() and set_*()
methods, nor would they benefit from having them.  Class::FakeAttributes
is designed to help with one specific situation, and I think giving it
capabilities to help with something that applies independently of that
situation would be confusing.

But if the consensus of this list is that I should remove
Class::FakeAttributes from Cpan then I shall do so.

Smylers


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About