/[cvs]/nfo/perl/libs/DesignPattern/Bridge.pm
ViewVC logotype

Diff of /nfo/perl/libs/DesignPattern/Bridge.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by joko, Fri Feb 21 08:38:21 2003 UTC revision 1.12 by joko, Tue May 13 08:39:22 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## --------------------------------------------------------------------------------  ## --------------------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.12  2003/05/13 08:39:22  joko
6    ##  autocalling constructor after instantiation
7    ##  added pod documentation
8    ##
9  ##  Revision 1.11  2003/02/21 08:38:21  joko  ##  Revision 1.11  2003/02/21 08:38:21  joko
10  ##  + additional checks  ##  + additional checks
11  ##  + raising exceptions  ##  + raising exceptions
# Line 55  use base qw( Line 59  use base qw(
59    
60  use Data::Dumper;  use Data::Dumper;
61    
62  ## ========   object inheritance   ========  =pod
63    
64    =head1 NAME
65    
66      DesignPattern::Bridge
67    
68    
69    =head1 DESCRIPTION
70    
71      This acts as a generic backplane for plugins using "Mix-in inheritance".
72    
73    
74    =head2 BACKGROUND
75      
76      Mix-in inheritance
77      Please visit [http://citeseer.nj.nec.com/bracha90mixinbased.html].
78      
79      [...]
80      Abstract: The diverse inheritance mechanisms provided by Smalltalk, Beta,
81      and CLOS are interpreted as different uses of a single underlying construct.
82      Smalltalk and Beta differ primarily in the direction of class hierarchy growth.
83      These inheritance mechanisms are subsumed in a new inheritance model
84      based on composition of mixins, or abstract subclasses. This form of
85      inheritance can also encode a CLOS multiple-inheritance hierarchy, although
86      changes to the encoded hierarchy that would violate... (Update)
87      [...]
88      
89      ...level, and can naturally span component boundaries. Jiazzi supports
90      the composition of class extending components; e.g. mixins [1]. Mixins
91      and cyclic component linking can be combined into an open class pattern,
92      which allows independent features that cross cut class...
93    
94    =head3 History of "mixins"
95    
96    =head4 G. Bracha, W. Cook. Mixin-based inheritance.
97    
98      G. Bracha and W. Cook, "Mixin-Based Inheritance", ECOOP/OOPSLA 1990, 303-311.
99      G. Bracha, W. Cook. Mixin-based inheritance. In OOPSLA/ECOOP '90 Conference Proceedings. ACM SIGPLAN Notices 25, 10 (Oct. 1990).
100    
101      @inproceedings{ bracha90mixinbased,
102          author = "Gilad Bracha and William Cook",
103          title = "Mixin-Based Inheritance",
104          booktitle = "Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications / Proceedings of the European Conference on Object-Oriented Programming",
105          publisher = "ACM Press",
106          address = "Ottawa, Canada",
107          editor = "Norman Meyrowitz",
108          pages = "303--311",
109          year = "1990",
110          url = "citeseer.nj.nec.com/bracha90mixinbased.html" }
111    
112    =head4 D. Duggan and C. Sourelis. Mixin modules.
113    
114      http://users.hol.gr/~csourelis/thesis.html
115    
116      @misc{ duggan96mixin,
117        author = "D. Duggan and C. Sourelis",
118        title = "Mixin modules",
119        text = "D. Duggan and C. Sourelis. Mixin modules. In Intl. Conf. on Functional
120          Programming, Philadelphia, May 1996. ACM Press.",
121        year = "1996",
122        url = "citeseer.nj.nec.com/sourelis95mixin.html" }
123    
124    =head4 Google on your own:
125    
126      http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=mix-in+inheritance
127      http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&q=Moo86+mixins
128      
129    
130    =head3 Discussion
131    
132      http://citeseer.nj.nec.com/context/6117/0
133    
134    =head2 References
135    
136      The Jigsaw Framework:
137        http://citeseer.nj.nec.com/bracha92programming.html
138        
139      http://citeseer.nj.nec.com/114070.html
140      http://citeseer.nj.nec.com/445396.html
141      http://citeseer.nj.nec.com/tichelaar97coordination.html
142      http://citeseer.nj.nec.com/meijler98beyond.html
143    
144      http://citeseer.nj.nec.com/89291.html
145      http://citeseer.nj.nec.com/sousa91runtime.html
146      http://citeseer.nj.nec.com/banavar95application.html
147      http://citeseer.nj.nec.com/sourelis95mixin.html
148      http://citeseer.nj.nec.com/hirschowitz02mixin.html
149      
150      Java: http://csis.pace.edu/~bergin/patterns/multipleinheritance.html
151      C++: http://www.oofile.com.au/oofdoc/samples/ooftst19.htm
152      
153    =head3 Related
154    
155      http://citeseer.nj.nec.com/nrelated/6117/23339
156    
157    
158  # TODO / REFACTORING PROPOSAL  =head3 Traits - Composable Units of Behavior
 # 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  
159    
160  # 2003-02-11, joko: does this have anything in parallel with CPAN's Class::Inner?    via: http://citeseer.nj.nec.com/context/22076/0
161    
162      Traits: Composable Units of Behavior - Nathanael Schrli Stphane   (Correct)
163      ....is not expressive enough to factor out common features (i.e. instance
164      variables and methods) shared by classes in a complex hierarchy. As a
165      consequence, language designers have proposed various forms of multiple
166      inheritance [Mey88] Kee89] Str86] as well as other mechanisms, such as
167      mixins [Moo86] BC90] FKF98] that allow classes to be composed incrementally
168      from sets of features. Despite the passage of nearly twenty years, neither
169      multiple inheritance nor mixins have achieved wide acceptance [Tai96]
170      Summarizing Alan Snyder s contribution to the inheritance panel discussion
171      at OOPSLA ....
172    
173      ....complete. But as a unit of reuse, a class should be small. These properties
174      often conflict. Furthermore, the role of classes as instance generators requires
175      that each class have a unique place in the class hierarchy, whereas units of
176      reuse should be applicable at arbitrary places. Moon s Flavors [Moo86] were
177      an early attempt to address this problem: Flavors are small, not necessarily
178      complete, and they can be mixed in at arbitrary places in the class hierarchy.
179      More sophisticated notions of mixins were subsequently developed by Bracha
180      and Cook [BC90] and Flatt, Krishnamurthi and Felleisen ....
181    
182      David A. Moon. Object-oriented programming with flavors. In Proceedings
183      OOPSLA '86, ACM SIGPLAN Notices, pages 1--8, November 1986.
184      Published as Proceedings OOPSLA '86, ACM SIGPLAN Notices, volume 21, number 11.
185    
186    
187      from: http://citeseer.nj.nec.com/566972.html
188      
189      Abstract: Inheritance is the fundamental reuse mechanism in object-oriented
190      programming languages; its most prominent variants are single inheritance,
191      multiple inheritance, and mixin inheritance. In the first part of this paper,
192      we identify and illustrate the conceptual and practical reusability problems
193      that arise with these forms of inheritance. We then present a simple
194      compositional model for structuring object-oriented programs, which we call traits.
195      Traits are essentially groups of methods... (Update)
196    
197    
198    =head3 Hybrid - A Language for Programming with Active Objects
199    
200      http://citeseer.nj.nec.com/561934.html
201      http://citeseer.nj.nec.com/nierstrasz92tour.html
202      http://www.iam.unibe.ch/~scg/Archive/NFS/cao.html
203    
204    =head3 Active Objects and Oberon
205    
206    
207    =head2 DETAILS
208    
209      This attempts to be a runtime wrapper around mixin.pm, written by Michael G Schwern
210      and available on CPAN.
211      Please visit:
212      http://magnonel.guild.net/~schwern/talks/Design_Patterns/full_slides/slide036.html
213      
214      
215    =head2 NOTES
216    
217      ## ========   object inheritance   ========
218    
219      2002-12:
220        TODO / REFACTORING PROPOSAL
221        leading from Data::Storage to code abstracted out into this module - DesignPattern::Bridge
222          - this is no inheritance and it doesn't have to be
223          - implement this module as a bridge to its sub-modules
224          - use the BridgePattern (http://c2.com/cgi/wiki?BridgePattern)
225              Using patterns was already successfully done with Data::Storage::Handler
226              by implementing the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern)
227              with Perl's AUTOLOAD-mechanism
228          - try to use Perl's "tie" command to implement this functionality here instead of using AUTOLOAD!
229          - sub getChildNodes
230          - sub run
231        
232      2003-02-11, joko: Does this have anything in parallel with CPAN's Class::Inner? No!
233    
234    
235    =head1 TODO
236    
237      o use Class::Loader
238      o rename to mixin::runtime?
239      
240    
241    =cut
242    
243    
244  # get logger instance  # get logger instance
# Line 91  sub new { Line 260  sub new {
260    
261    # create instance    # create instance
262    bless $self, $class;    bless $self, $class;
263    
264      # NEW: 2003-04-16
265      $self->constructor() if $self->can('constructor');
266        
267    return $self;    return $self;
268  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed