SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Self




       ”More Smalltalk than Smalltalk”




  Michal P´se (CTU in Prague)
          ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   2/7
Self




       ”More Smalltalk than Smalltalk”
       Goal: to simplify the language as much as possible




  Michal P´se (CTU in Prague)
          ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   2/7
Results




     Fields and methods are slots




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   3/7
Results




     Fields and methods are slots
     No classes, only cloning and modification




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   3/7
Results




     Fields and methods are slots
     No classes, only cloning and modification
     Dynamic inheritance




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   3/7
Dynamic Inheritance




     Some slots may be marked parent slots.
     Lookup algorithm traverses these slots.
     Even when invoking a method found in a different object, the receiver
     does not change.




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   4/7
The Little Differences




See the following patterns: singleton, proxy, chain of responsibility, state
and strategy.




  Michal P´se (CTU in Prague)
          ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   5/7
Let’s Look at Dynamic Inheritance Once More




     How is it different from composition?




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   6/7
Let’s Look at Dynamic Inheritance Once More




     How is it different from composition?
     How is it different from ”static” inheritance?




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   6/7
Let’s Look at Dynamic Inheritance Once More




     How is it different from composition?
     How is it different from ”static” inheritance?
     Perhaps there exists a concept generalizing both?




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   6/7
See




James Noble and Brian Foote. Attack of the clones. In Proceedings of
the 2002 conference on Pattern languages of programs - Volume 13
(CRPIT ’02) (2002), 99–114.




 Michal P´se (CTU in Prague)
         ıˇ                    Object Programming Lect. 13: Prototype Languages   December 21, 2010   7/7

Contenu connexe

En vedette

Every Consumer is a Business user is a Consumer
Every Consumer is a Business user is a ConsumerEvery Consumer is a Business user is a Consumer
Every Consumer is a Business user is a ConsumerMichael Kogeler
 
What Would You Say
What Would You SayWhat Would You Say
What Would You Sayguest123f4
 

En vedette (6)

Every Consumer is a Business user is a Consumer
Every Consumer is a Business user is a ConsumerEvery Consumer is a Business user is a Consumer
Every Consumer is a Business user is a Consumer
 
Functional Concepts
Functional ConceptsFunctional Concepts
Functional Concepts
 
What Would You Say
What Would You SayWhat Would You Say
What Would You Say
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
België Nederland
België NederlandBelgië Nederland
België Nederland
 
T+L Copy2
T+L Copy2T+L Copy2
T+L Copy2
 

Plus de Michal Píše

Plus de Michal Píše (6)

Garbage Collection
Garbage CollectionGarbage Collection
Garbage Collection
 
Flow Control
Flow ControlFlow Control
Flow Control
 
Reclassification
ReclassificationReclassification
Reclassification
 
Multiple Dispatch
Multiple DispatchMultiple Dispatch
Multiple Dispatch
 
Inheritance
InheritanceInheritance
Inheritance
 
Type Systems
Type SystemsType Systems
Type Systems
 

Prototype Languages

  • 1.
  • 2. Self ”More Smalltalk than Smalltalk” Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 2/7
  • 3. Self ”More Smalltalk than Smalltalk” Goal: to simplify the language as much as possible Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 2/7
  • 4. Results Fields and methods are slots Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
  • 5. Results Fields and methods are slots No classes, only cloning and modification Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
  • 6. Results Fields and methods are slots No classes, only cloning and modification Dynamic inheritance Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
  • 7. Dynamic Inheritance Some slots may be marked parent slots. Lookup algorithm traverses these slots. Even when invoking a method found in a different object, the receiver does not change. Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 4/7
  • 8. The Little Differences See the following patterns: singleton, proxy, chain of responsibility, state and strategy. Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 5/7
  • 9. Let’s Look at Dynamic Inheritance Once More How is it different from composition? Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
  • 10. Let’s Look at Dynamic Inheritance Once More How is it different from composition? How is it different from ”static” inheritance? Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
  • 11. Let’s Look at Dynamic Inheritance Once More How is it different from composition? How is it different from ”static” inheritance? Perhaps there exists a concept generalizing both? Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
  • 12. See James Noble and Brian Foote. Attack of the clones. In Proceedings of the 2002 conference on Pattern languages of programs - Volume 13 (CRPIT ’02) (2002), 99–114. Michal P´se (CTU in Prague) ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 7/7