--- nfo/perl/libs/DesignPattern/Bridge.pm 2003/02/21 08:38:21 1.11 +++ nfo/perl/libs/DesignPattern/Bridge.pm 2003/05/13 08:39:22 1.12 @@ -1,7 +1,11 @@ ## -------------------------------------------------------------------------------- -## $Id: Bridge.pm,v 1.11 2003/02/21 08:38:21 joko Exp $ +## $Id: Bridge.pm,v 1.12 2003/05/13 08:39:22 joko Exp $ ## -------------------------------------------------------------------------------- ## $Log: Bridge.pm,v $ +## Revision 1.12 2003/05/13 08:39:22 joko +## autocalling constructor after instantiation +## added pod documentation +## ## Revision 1.11 2003/02/21 08:38:21 joko ## + additional checks ## + raising exceptions @@ -55,21 +59,186 @@ use Data::Dumper; -## ======== object inheritance ======== +=pod + +=head1 NAME + + DesignPattern::Bridge + + +=head1 DESCRIPTION + + This acts as a generic backplane for plugins using "Mix-in inheritance". + + +=head2 BACKGROUND + + Mix-in inheritance + Please visit [http://citeseer.nj.nec.com/bracha90mixinbased.html]. + + [...] + Abstract: The diverse inheritance mechanisms provided by Smalltalk, Beta, + and CLOS are interpreted as different uses of a single underlying construct. + Smalltalk and Beta differ primarily in the direction of class hierarchy growth. + These inheritance mechanisms are subsumed in a new inheritance model + based on composition of mixins, or abstract subclasses. This form of + inheritance can also encode a CLOS multiple-inheritance hierarchy, although + changes to the encoded hierarchy that would violate... (Update) + [...] + + ...level, and can naturally span component boundaries. Jiazzi supports + the composition of class extending components; e.g. mixins [1]. Mixins + and cyclic component linking can be combined into an open class pattern, + which allows independent features that cross cut class... + +=head3 History of "mixins" + +=head4 G. Bracha, W. Cook. Mixin-based inheritance. + + G. Bracha and W. Cook, "Mixin-Based Inheritance", ECOOP/OOPSLA 1990, 303-311. + G. Bracha, W. Cook. Mixin-based inheritance. In OOPSLA/ECOOP '90 Conference Proceedings. ACM SIGPLAN Notices 25, 10 (Oct. 1990). + + @inproceedings{ bracha90mixinbased, + author = "Gilad Bracha and William Cook", + title = "Mixin-Based Inheritance", + booktitle = "Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications / Proceedings of the European Conference on Object-Oriented Programming", + publisher = "ACM Press", + address = "Ottawa, Canada", + editor = "Norman Meyrowitz", + pages = "303--311", + year = "1990", + url = "citeseer.nj.nec.com/bracha90mixinbased.html" } + +=head4 D. Duggan and C. Sourelis. Mixin modules. + + http://users.hol.gr/~csourelis/thesis.html + + @misc{ duggan96mixin, + author = "D. Duggan and C. Sourelis", + title = "Mixin modules", + text = "D. Duggan and C. Sourelis. Mixin modules. In Intl. Conf. on Functional + Programming, Philadelphia, May 1996. ACM Press.", + year = "1996", + url = "citeseer.nj.nec.com/sourelis95mixin.html" } + +=head4 Google on your own: + + http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=mix-in+inheritance + http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=Moo86+mixins + + +=head3 Discussion + + http://citeseer.nj.nec.com/context/6117/0 + +=head2 References + + The Jigsaw Framework: + http://citeseer.nj.nec.com/bracha92programming.html + + http://citeseer.nj.nec.com/114070.html + http://citeseer.nj.nec.com/445396.html + http://citeseer.nj.nec.com/tichelaar97coordination.html + http://citeseer.nj.nec.com/meijler98beyond.html + + http://citeseer.nj.nec.com/89291.html + http://citeseer.nj.nec.com/sousa91runtime.html + http://citeseer.nj.nec.com/banavar95application.html + http://citeseer.nj.nec.com/sourelis95mixin.html + http://citeseer.nj.nec.com/hirschowitz02mixin.html + + Java: http://csis.pace.edu/~bergin/patterns/multipleinheritance.html + C++: http://www.oofile.com.au/oofdoc/samples/ooftst19.htm + +=head3 Related + + http://citeseer.nj.nec.com/nrelated/6117/23339 + -# TODO / REFACTORING PROPOSAL -# leading from Data::Storage to code abstracted out into this module - DesignPattern::Bridge -# - this is no inheritance and it doesn't have to be -# - implement this module as a bridge to its sub-modules -# - use the BridgePattern (http://c2.com/cgi/wiki?BridgePattern) -# Using patterns was already successfully done with Data::Storage::Handler -# by implementing the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern) -# with Perl's AUTOLOAD-mechanism -# - try to use Perl's "tie" command to implement this functionality here instead of using AUTOLOAD! -# - sub getChildNodes -# - sub run +=head3 Traits - Composable Units of Behavior -# 2003-02-11, joko: does this have anything in parallel with CPAN's Class::Inner? + via: http://citeseer.nj.nec.com/context/22076/0 + + Traits: Composable Units of Behavior - Nathanael Schrli Stphane (Correct) + ....is not expressive enough to factor out common features (i.e. instance + variables and methods) shared by classes in a complex hierarchy. As a + consequence, language designers have proposed various forms of multiple + inheritance [Mey88] Kee89] Str86] as well as other mechanisms, such as + mixins [Moo86] BC90] FKF98] that allow classes to be composed incrementally + from sets of features. Despite the passage of nearly twenty years, neither + multiple inheritance nor mixins have achieved wide acceptance [Tai96] + Summarizing Alan Snyder s contribution to the inheritance panel discussion + at OOPSLA .... + + ....complete. But as a unit of reuse, a class should be small. These properties + often conflict. Furthermore, the role of classes as instance generators requires + that each class have a unique place in the class hierarchy, whereas units of + reuse should be applicable at arbitrary places. Moon s Flavors [Moo86] were + an early attempt to address this problem: Flavors are small, not necessarily + complete, and they can be mixed in at arbitrary places in the class hierarchy. + More sophisticated notions of mixins were subsequently developed by Bracha + and Cook [BC90] and Flatt, Krishnamurthi and Felleisen .... + + David A. Moon. Object-oriented programming with flavors. In Proceedings + OOPSLA '86, ACM SIGPLAN Notices, pages 1--8, November 1986. + Published as Proceedings OOPSLA '86, ACM SIGPLAN Notices, volume 21, number 11. + + + from: http://citeseer.nj.nec.com/566972.html + + Abstract: Inheritance is the fundamental reuse mechanism in object-oriented + programming languages; its most prominent variants are single inheritance, + multiple inheritance, and mixin inheritance. In the first part of this paper, + we identify and illustrate the conceptual and practical reusability problems + that arise with these forms of inheritance. We then present a simple + compositional model for structuring object-oriented programs, which we call traits. + Traits are essentially groups of methods... (Update) + + +=head3 Hybrid - A Language for Programming with Active Objects + + http://citeseer.nj.nec.com/561934.html + http://citeseer.nj.nec.com/nierstrasz92tour.html + http://www.iam.unibe.ch/~scg/Archive/NFS/cao.html + +=head3 Active Objects and Oberon + + +=head2 DETAILS + + This attempts to be a runtime wrapper around mixin.pm, written by Michael G Schwern + and available on CPAN. + Please visit: + http://magnonel.guild.net/~schwern/talks/Design_Patterns/full_slides/slide036.html + + +=head2 NOTES + + ## ======== object inheritance ======== + + 2002-12: + TODO / REFACTORING PROPOSAL + leading from Data::Storage to code abstracted out into this module - DesignPattern::Bridge + - this is no inheritance and it doesn't have to be + - implement this module as a bridge to its sub-modules + - use the BridgePattern (http://c2.com/cgi/wiki?BridgePattern) + Using patterns was already successfully done with Data::Storage::Handler + by implementing the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern) + with Perl's AUTOLOAD-mechanism + - try to use Perl's "tie" command to implement this functionality here instead of using AUTOLOAD! + - sub getChildNodes + - sub run + + 2003-02-11, joko: Does this have anything in parallel with CPAN's Class::Inner? No! + + +=head1 TODO + + o use Class::Loader + o rename to mixin::runtime? + + +=cut # get logger instance @@ -91,6 +260,9 @@ # create instance bless $self, $class; + + # NEW: 2003-04-16 + $self->constructor() if $self->can('constructor'); return $self; }