SlideShare a Scribd company logo
1 of 40
PHP.next:	
  Traits	
  

Horizontal	
  Reuse	
  of	
  Behavior	
  



                   Stefan	
  Marr	
  
            AFUP,	
  La	
  Can@ne,	
  Paris	
  
             15th	
  December	
  2010	
  
Ques@ons	
  at	
  any	
  @me	
  
Traits	
  for	
  PHP	
  Started	
  December	
  2007	
  




15/12/10	
                                         3	
  
Today:	
  Virtual	
  Machines	
  for	
  the	
  Manycore	
  Era	
  




                              hOp://soR.vub.ac.be/~smarr/research/	
  
                              hOp://github.com/smarr/RoarVM	
  




15/12/10	
                                                      4	
  
Who	
  are	
  you?	
  
•  PHP	
  Programmer:	
  Job	
  or	
  Hobby?	
  

•  C	
  Programmer?	
  (PHP	
  core/extensions?)	
  

•  Contribu@on	
  to	
  Open	
  Source	
  projects?	
  




15/12/10	
                                                5	
  
Off-­‐Topic…	
  
               Anyone	
  using:	
  
               •  COCOMO,	
  COCOMO	
  II	
  
               •  Func@on	
  points	
  
               •  User	
  Story	
  Points	
  




15/12/10	
                                      6	
  
Ques@ons	
  at	
  any	
  @me	
  
Agenda	
  
•    Why	
  Traits?	
  
•    The	
  Language	
  Design	
  
•    Traits	
  Applied	
  
•    Implementa@on	
  inside	
  the	
  Zend	
  Engine	
  




15/12/10	
                                                  8	
  
Reuse	
  in	
  Programming	
  Languages	
  

    WHY	
  TRAITS?	
  


15/12/10	
                         Stefan	
  Marr	
  –	
  PHP.next:	
  Traits	
     9	
  
Single	
  Inheritance	
  
                                                                             Vertebrates
•  Simple	
  but	
  not	
  	
  
   expressive	
  enough	
  

•  Leads	
  to	
                                           Dinosaurs                       Mammal

    •  Code	
  duplica@on	
  
    •  Inappropriate	
  	
  
       hierarchies	
                                     Archaeoptrix                          Bat


                                                        fly()                          fly()



15/12/10	
             Approaches	
  for	
  ComposiIon	
  and	
  their	
  Limits	
                   10	
  
Mul@ple	
  Inheritance	
  
                  Animal                                         •  Very	
  expressive	
  
                +move()

                                                                 •  But	
  
         Bird
                            Swimmer                                  •  Diamond	
  problem	
  
  +move()
                           +move()
                                                                     •  Fragile	
  hierarchies	
  
  +getLegs()



                  Penguin                                    class Penguin {
                                                               function move() {
                +move()                                          Swimmer::move();
                                                               }
                                                             }



15/12/10	
                    Approaches	
  for	
  ComposiIon	
  and	
  their	
  Limits	
     11	
  
Mixins	
  
                                                Animal




                                           WingAnimal
                                                                          <<mixin>> (1)   Bat
                  <<mixin>> (1)
                                       bones = light
                                       extremity = wings
        Penguin                        move()

                  <<mixin>> (2)            SwimAnimal
                                       extremity = fins
                                       move()




15/12/10	
              Approaches	
  for	
  ComposiIon	
  and	
  their	
  Limits	
             12	
  
Mixins	
  
                                                Animal




                                           WingAnimal
                                                                          <<mixin>> (1)    Bat
                  <<mixin>> (1)
                                       bones = light
                                       extremity = wings
        Penguin                        move()

                  <<mixin>> (2)            SwimAnimal
                                       extremity = fins                      •  Lack	
  of	
  composi@on	
  
                                       move()                                   control	
  
                                                                             •  Fragile	
  hierarchies	
  

15/12/10	
              Approaches	
  for	
  ComposiIon	
  and	
  their	
  Limits	
              13	
  
Limita@ons	
  
•    Code	
  duplica@on	
  
•    Inappropriate	
  hierarchies	
  
•    Diamond	
  problem	
  
•    Fragile	
  hierarchies	
  
•    Lack	
  of	
  composi@on	
  control	
  




15/12/10	
           Approaches	
  for	
  ComposiIon	
  and	
  their	
  Limits	
     14	
  
Traits	
  for	
  PHP	
  

    THE	
  LANGUAGE	
  DESIGN	
  


15/12/10	
                     Stefan	
  Marr	
  –	
  PHP.next:	
  Traits	
     15	
  
                                                      	
  
Traits	
  
•    Set	
  of	
  methods	
  
•    Possibly	
  composed	
  of	
  other	
  Traits	
  
•    Composi@on	
  is	
  unordered	
                                TFoo

•    Composi@on	
  opera@ons	
              TTrait
                                                               foo()

                                                                       TBar
       –  Sum	
                                  m1()
                                                 m2()          bar()
                          MyClass
       –  Exclusion	
                              TConflict
       –  Aliasing	
                             m2()

•  Can	
  be	
  flaOened	
  away	
  
15/12/10	
                          Traits	
                       16	
  
Traits	
  in	
  Ac@on	
  




15/12/10	
               Traits	
          17	
  
Method	
  in	
  Class	
  Overrides	
  Trait	
  
                              Base	
  
                         foo()	
  
                                                                   class	
  Base	
  {	
  
Code	
  




                                                                   	
  	
  function	
  foo()	
  {	
  echo	
  'B';}}	
  
                                 A	
                T	
            	
  
                         foo()	
            foo()	
                trait	
  T	
  {	
  
                                                                   	
  	
  function	
  foo()	
  {	
  echo	
  'T';}}	
  
                              Base	
                               	
  
Compiled	
  Result	
  




                         foo()	
                                   class	
  A	
  extends	
  Base	
  {	
  
                                                                   	
  	
  use	
  T;	
  
                                                                   	
  	
  function	
  foo()	
  {	
  echo	
  'A';}}	
  
                                 A	
  
                         foo()	
         echo	
  'A';	
  

                  15/12/10	
                                Traits	
                                    18	
  
Conflicts	
  are	
  Explicit	
  
                              Base	
  
                                                                                  class	
  Base	
  {	
  
                         foo()	
                                                  	
  	
  function	
  foo()	
  {	
  echo	
  'B';}}	
  
                                                         T1	
  
                                                                                  	
  
Code	
  




                                                  foo()	
                         trait	
  T1	
  {	
  
                                 A	
                                              	
  	
  function	
  foo()	
  {echo	
  'T1';}}	
  
                                                         T2	
                     	
  
                                                  foo()	
                         trait	
  T2	
  {	
  
                              Base	
                                              	
  	
  function	
  foo()	
  {echo	
  'T2';}}	
  
Compiled	
  Result	
  




                         foo()	
                                                  	
  
                                                                                  class	
  A	
  extends	
  Base	
  {	
  
                                                                                  	
  	
  use	
  T1,	
  T2;	
  
                                 A	
     >>	
  Fatal	
  error:	
  	
              }	
  
                                         	
  	
  	
  collision	
  on	
  foo	
  

                  15/12/10	
                                              Traits	
                                     19	
  
                                                                            	
  
Solving	
  Conflicts	
  
                              Base	
  
                                                                           class	
  Base	
  {	
  
                         foo()	
                                           	
  	
  function	
  foo()	
  {	
  echo	
  'B';}}	
  
                                                           T1	
  
                                                                           trait	
  T1	
  {	
  
Code	
  




                                                    foo()	
                	
  	
  function	
  foo()	
  {echo	
  'T1';}}	
  
                                 A	
                                       trait	
  T2	
  {	
  
                                                           T2	
            	
  	
  function	
  foo()	
  {echo	
  'T2';}}	
  
                                         !foo	
  
                                                    foo()	
                	
  
                              Base	
                                       class	
  A	
  extends	
  Base	
  {	
  
Compiled	
  Result	
  




                         foo()	
                                           	
  	
  use	
  T1,	
  T2	
  {	
  
                                                                           	
  	
  	
  	
  T1::foo	
  insteadof	
  T2;	
  
                                                                           	
  	
  }	
  
                                 A	
                                       }	
  
                         foo()	
         >>	
  echo	
  'T1';	
  


                  15/12/10	
                                        Traits	
                                    20	
  
                                                                      	
  
Aliasing	
  
                              Base	
  
                                                                               class	
  Base	
  {	
  
                         foo()	
                                               	
  	
  function	
  foo()	
  {	
  echo	
  'B';}}	
  
                                                               T1	
  
                                                                               trait	
  T1	
  {	
  
Code	
  




                                                        foo()	
                	
  	
  function	
  foo()	
  {echo	
  'T1';}}	
  
                                 A	
                                           trait	
  T2	
  {	
  
                                         !foo	
                T2	
            	
  	
  function	
  foo()	
  {echo	
  'T2';}}	
  
                                         +foo2	
  
                                                        foo()	
                	
  
                              Base	
                                           class	
  A	
  extends	
  Base	
  {	
  
Compiled	
  Result	
  




                         foo()	
                                               	
  	
  use	
  T1,	
  T2	
  {	
  
                                                                               	
  	
  	
  	
  T1::foo	
  insteadof	
  T2;	
  
                                                                               	
  	
  	
  	
  T2::foo	
  as	
  fooT2;	
  
                              A	
  
                         foo()	
         >>	
  echo	
  'T1';	
  
                                                                               	
  	
  }	
  
                         foo2()	
        >>	
  echo	
  'T2';	
                 }	
  

                  15/12/10	
                                            Traits	
                                    21	
  
                                                                          	
  
Aliasing	
  IS	
  NOT	
  Renaming	
  
trait	
  T1	
  {	
                            class	
  A	
  {	
  
	
  	
  function	
  bar()	
  {	
  
	
  	
  	
  	
  echo	
  'T1::bar';	
  
                                              	
  	
  use	
  T1,	
  T2	
  {	
  
	
  	
  }	
                                   	
  	
  	
  	
  T2::bar	
  insteadof	
  T1;	
  
	
  	
  function	
  foo()	
  {	
              	
  	
  	
  	
  T1::bar	
  as	
  bar2;	
  
	
  	
  	
  	
  $this-­‐>bar();	
  
                                              	
  	
  }	
  
	
  	
  }	
  
}	
                                           }	
  
trait	
  T2	
  {	
                            	
  
	
  	
  function	
  bar()	
  {	
  
                                              $a	
  =	
  new	
  A;	
  
	
  	
  	
  	
  echo	
  'T2::bar’;	
  
	
  	
  }	
                                   $a-­‐>foo();	
  //	
  echo	
  ??	
  
}	
  

15/12/10	
                               Traits	
                               22	
  
                                           	
  
Late	
  Binding	
  for	
  Composability	
  
trait	
  MovingAnimal	
  {	
                            class	
  Penguin	
  {	
  
	
  	
  function	
  move()	
  {	
                       	
  	
  use	
  WingAnimal,	
  SwimAnimal	
  {	
  
	
  	
  	
  	
  $this-­‐>extremities()-­‐>use();	
      	
  	
  	
  	
  WingAnimal::extremities	
  
	
  	
  }}	
                                            	
  	
  	
  	
  	
  	
  insteadof	
  SwimAnimal;	
  
trait	
  WingAnimal	
  {	
                              	
  	
  }	
  
	
  	
  use	
  MovingAnimal;	
                          }	
  
	
  	
  function	
  extremities()	
  {	
                	
  
	
  	
  	
  	
  return	
  $this-­‐>wings;	
             $skipper	
  =	
  new	
  Penguin;	
  
	
  	
  }}	
                                            $skipper-­‐>move();	
  //	
  will	
  use	
  
trait	
  SwimAnimal	
  {	
                              	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  his	
  wings	
  
	
  	
  use	
  MovingAnimal;	
  
	
  	
  function	
  extremities()	
  {	
  
	
  	
  	
  	
  return	
  $this-­‐>fins;	
  
	
  	
  }}	
  

 15/12/10	
                                      Traits	
                                                                               23	
  
                                                   	
  
Traits	
  and	
  State	
  
trait	
  Counter	
  {	
  
	
  	
  abstract	
  function	
  &getValueVar();	
  
	
  	
  function	
  inc($inc	
  =	
  1)	
  {	
  
	
  	
  	
  	
  $var	
  =	
  &$this-­‐>getValueVar();	
  
	
  	
  	
  	
  $var	
  =	
  $var	
  +	
  $inc;	
  
	
  	
  }}	
  
class	
  PageWithCounter	
  {	
  
	
  	
  use	
  Counter;	
  
	
  	
  public	
  $counter	
  =	
  1;	
  
	
  	
  function	
  &getValueVar()	
  {	
  return	
  $this-­‐>counter;	
  }	
  
}	
  
$page	
  =	
  new	
  PageWithCounter;	
  $page-­‐>inc();	
  
var_dump($page-­‐>counter);	
  


 15/12/10	
                                   Traits	
                            24	
  
                                                	
  
Case	
  Studies	
  Illustra@ng	
  Benefits	
  of	
  Traits	
  

    TRAITS	
  APPLIED	
  


15/12/10	
                              Stefan	
  Marr	
  –	
  PHP.next:	
  Traits	
     25	
  
                                                               	
  
Use	
  Case	
  for	
  Traits	
  
•  ezcReflec@on	
  enhances	
  PHP	
  Reflec@on	
  API	
  
       –  Adds	
  XDoclet	
  like	
  annota@ons	
  for	
  PHP	
  
       –  Enhances	
  type	
  hin@ng	
  using	
  PHPDoc	
  type	
  
          annota@ons	
  
•  Illustrates	
  solu@on	
  for	
  code	
  duplica@on	
  
   problems	
                                  «interface»
                                                Reflector




           ReflectionProperty   ReflectionClass             ReflectionFunction   ReflectionParameter


                                ReflectionObject             ReflectionMethod



15/12/10	
                                   Traits	
  Applied	
                                26	
  
Refactoring	
  ezcReflec@on	
  with	
  Traits	
  




15/12/10	
              Traits	
  Applied	
     27	
  
Refactoring	
  ezcReflec@on	
  with	
  Traits	
  




15/12/10	
              Traits	
  Applied	
     28	
  
Implementa@on	
  details:	
  
           Not	
  to	
  be	
  confused	
  with	
  language	
  seman@cs!	
  




    The	
  Traits	
  Implementa@on	
  

    INSIDE	
  THE	
  ZEND	
  ENGINE	
  


15/12/10	
                         Stefan	
  Marr	
  –	
  PHP.next:	
  Traits	
     29	
  
                                                          	
  
Zend	
  Engine	
  Overview	
  
                                    PHP	
  +	
  Zend	
  Engine	
  

                 YACC	
                    Opcodes	
  
 Script	
        Parser	
                 Structures	
  

                                                                             Opcode	
  
                                                                           Interpreter	
         Result	
  

 Input	
                      Input	
  




15/12/10	
                       Traits	
  inside	
  the	
  Zend	
  Engine	
                 30	
  
YACC	
  
                                  Parser	
                                          Parser	
  



•  Added	
  keywords	
  
       –  trait	
  
       –  insteadof	
  


•  Grammar	
  rules	
  based	
  on	
  class	
  	
  




15/12/10	
                 Traits	
  inside	
  the	
  Zend	
  Engine	
     31	
  
                                                	
  
PHP	
  +	
  Zend	
  
                                                                                   Engine	
  
                               Zend	
  Engine	
  
•  Trait	
  internally	
  a	
  class	
  with	
  ZEND_ACC_TRAIT	
  
       –  New	
  data	
  structures	
  
               •  zend_trait_method_reference	
  
               •  zend_trait_precedence	
  
               •  zend_trait_alias	
  
       –  Class	
  members	
  added	
  to	
  zend_class_entry	
  
               •    zend_class_entry	
  **traits;	
  
               •    zend_uint	
  num_traits;	
  
               •    zend_trait_alias	
  **trait_aliases;	
  
               •    zend_trait_precedence	
  **trait_precedences;	
  
•  Support	
  in	
  Reflec@on	
  API	
  
15/12/10	
                       Traits	
  inside	
  the	
  Zend	
  Engine	
       32	
  
                                                      	
  
Opcode	
  
                                         Interpreter	
                                       Interpreter	
  



•  Added	
  Opcodes	
  
       –  ZEND_ADD_TRAIT	
  
               •  similar	
  to	
  ZEND_ADD_INTERFACE	
  
               •  Only	
  adds	
  info,	
  no	
  composi@on	
  done	
  
       –  ZEND_BIND_TRAITS	
  
               •  emiOed	
  in	
  zend_do_end_class_declara@on	
  
               •  will	
  ini@ate	
  trait	
  composi@on	
  at	
  run@me	
  
                    –  Only	
  once,	
  part	
  of	
  class	
  defini@on	
  process	
  	
  
                    –  (no	
  run@me	
  overhead)	
  


15/12/10	
                                 Traits	
  inside	
  the	
  Zend	
  Engine	
        33	
  
                                                                	
  
PHP	
  +	
  Zend	
  
                                                                                  Engine	
  
                   Composi@on	
  Process	
  
•  Implemented	
  in	
  zend_do_bind_traits	
  
1.  Init	
  traits	
  data	
  structures	
  (resolve	
  classes)	
  
2.  For	
  all	
  used	
  traits	
  
      –  Compile	
  method	
  table	
  of	
  all	
  used	
  methods	
  
      –  Respect	
  exclusion	
  and	
  aliases	
  
3.  Merge	
  resul@ng	
  tables	
  
4.  Add	
  methods	
  to	
  class	
  
      –  Handle	
  abstract	
  methods,	
  inheritance	
  
      –  duplicate	
  func@on	
  (like	
  copy/paste,	
  enables	
  static)	
  

15/12/10	
                      Traits	
  inside	
  the	
  Zend	
  Engine	
       34	
  
                                                     	
  
ROUNDUP	
  AND	
  CONCLUSION	
  


15/12/10	
       Stefan	
  Marr	
  –	
  PHP.next:	
  Traits	
     35	
  
                                        	
  
References	
  for	
  Traits	
  in	
  PHP	
  
RFC:	
  Horizontal	
  Reuse	
  in	
  PHP	
  
       Version	
  2.0.1,	
  last	
  update	
  2010-­‐11-­‐18	
  
       hOp://wiki.php.net/rfc/horizontalreuse	
  
	
  
Interes@ng	
  Blog	
  Posts	
  
       –  Simas	
  Toleikis:	
  Overview,	
  similar	
  to	
  RFC	
  
               •  hOp://simas.posterous.com/new-­‐to-­‐php-­‐54-­‐traits	
  
       –  Sebas@an	
  Deutsch:	
  Ac@veRecord	
  with	
  Traits	
  
               •  hOp://9elements.com/io/?p=28	
  

15/12/10	
                         Roundup	
  and	
  Conclusion	
         36	
  
                                                	
  
Conclusion	
  
•  Traits	
  are	
  mechanism	
  for	
  reuse	
  of	
  behavior	
  
•  Avoid	
  limita@ons	
  of	
  other	
  approaches	
  
       –  Avoid	
  code	
  duplica@on	
  
       –  Enhance	
  class	
  composi@on	
  capabili@es	
  
•  “Compiler	
  assisted	
  copy’n’paste”	
  
       –  FlaOened	
  into	
  class	
  
       –  No	
  run@me	
  overhead	
  


15/12/10	
                     Roundup	
  and	
  Conclusion	
     37	
  
                                            	
  
Basic	
  Literature	
  on	
  Traits	
  
Main	
  ArIcle	
  about	
  Traits	
  	
  
[3] 	
  S.	
  DUCASSE,	
  O.	
  NIERSTRASZ,	
  N.	
  SCHÄRLI,	
  R.	
  WUYTS,	
  AND	
  A.	
  P.	
  
        BLACK,	
  Traits:	
  A	
  Mechanism	
  for	
  Fine-­‐Grained	
  Reuse,	
  ACM	
  
        Trans.	
  Program.	
  Lang.	
  Syst.,	
  28	
  (2006),	
  pp.	
  331–388.	
  
	
  
Traits	
  Extensions	
  
[1]       	
  A.	
  BERGEL,	
  S.	
  DUCASSE,	
  O.	
  NIERSTRASZ,	
  AND	
  R.	
  WUYTS,	
  Stateful	
  Traits	
  and	
  their	
  
              Formaliza;on,	
  Journal	
  of	
  Computer	
  Languages,	
  Systems	
  and	
  Structures,	
  34	
  
              (2007),	
  pp.	
  83–108.	
  
[4]       	
  S.	
  DUCASSE,	
  R.	
  WUYTS,	
  A.	
  BERGEL,	
  AND	
  O.	
  NIERSTRASZ,	
  User-­‐Changeable	
  Visibility:	
  
              Resolving	
  Unan;cipated	
  Name	
  Clashes	
  in	
  Traits,	
  SIGPLAN	
  Not.,	
  42	
  (2007),	
  
              pp.	
  171–190.	
  

	
  
	
  
15/12/10	
                                        Roundup	
  and	
  Conclusion	
  
                                                               	
  
                                                                                                                         38	
  
Traits	
  Literature	
  
[1]A.	
  BERGEL,	
  S.	
  DUCASSE,	
  O.	
  NIERSTRASZ,	
  AND	
  R.	
  WUYTS,	
  Stateful	
  Traits	
  and	
  their	
  
  	
  
     Formaliza;on,	
  Journal	
  of	
  Computer	
  Languages,	
  Systems	
  and	
  Structures,	
  34	
  (2007),	
  
     pp.	
  83–108.	
  
[2]S.	
  DENIER,	
  Traits	
  Programming	
  with	
  AspectJ,	
  RSTI	
  -­‐	
  L'objet,	
  11	
  (2005),	
  pp.	
  69–86.	
  
  	
  
[3]S.	
  DUCASSE,	
  O.	
  NIERSTRASZ,	
  N.	
  SCHÄRLI,	
  R.	
  WUYTS,	
  AND	
  A.	
  P.	
  BLACK,	
  Traits:	
  A	
  Mechanism	
  
  	
  
     for	
  Fine-­‐Grained	
  Reuse,	
  ACM	
  Trans.	
  Program.	
  Lang.	
  Syst.,	
  28	
  (2006),	
  pp.	
  331–388.	
  
[4]S.	
  DUCASSE,	
  R.	
  WUYTS,	
  A.	
  BERGEL,	
  AND	
  O.	
  NIERSTRASZ,	
  User-­‐Changeable	
  Visibility:	
  
  	
  
     Resolving	
  Unan;cipated	
  Name	
  Clashes	
  in	
  Traits,	
  SIGPLAN	
  Not.,	
  42	
  (2007),	
  pp.	
  171–
     190.	
  
[5]S.	
  MARR	
  AND	
  F.	
  MENGE,	
  ezcReflec;on,	
  SVN	
  Repository,	
  eZ	
  Components,	
  January	
  
  	
  
     2008.	
  hOp://svn.ez.no/svn/ezcomponents/experimental/Reflec@on.	
  
[6]E.	
  R.	
  MURPHY-­‐HILL,	
  P.	
  J.	
  QUITSLUND,	
  AND	
  A.	
  P.	
  BLACK,	
  Removing	
  Duplica;on	
  from	
  
  	
  
     java.io:	
  a	
  Case	
  Study	
  using	
  Traits,	
  in	
  OOPSLA	
  '05:	
  Companion	
  to	
  the	
  20th	
  annual	
  
     ACM	
  SIGPLAN	
  conference	
  on	
  Object-­‐oriented	
  programming,	
  systems,	
  languages,	
  
     and	
  applica@ons,	
  New	
  York,	
  NY,	
  USA,	
  2005,	
  ACM,	
  pp.	
  282–291.	
  




15/12/10	
                                         Roundup	
  and	
  Conclusion	
                                         39	
  
Traits	
  Literature	
  
[7] 	
  PROGRAMMING	
  METHODS	
  LABORATORY,	
  Traits	
  for	
  Scala,	
  Programming	
  
        Language,	
  Ecole	
  Polytechnique	
  Fédérale	
  de	
  Lausanne,	
  2006.	
  hOp://
        www.scala-­‐lang.org/intro/traits.html.	
  
[8] 	
  P.	
  J.	
  QUITSLUND,	
  E.	
  R.	
  MURPHY-­‐HILL,	
  AND	
  A.	
  P.	
  BLACK,	
  Suppor;ng	
  Java	
  traits	
  in	
  
        Eclipse,	
  in	
  eclipse	
  '04:	
  Proceedings	
  of	
  the	
  2004	
  OOPSLA	
  workshop	
  on	
  
        eclipse	
  technology	
  eXchange,	
  New	
  York,	
  NY,	
  USA,	
  2004,	
  ACM,	
  pp.	
  37–41.	
  
[9] 	
  S.	
  REICHHART,	
  Traits	
  in	
  C#.	
  Video	
  of	
  Talk	
  at	
  MicrosoR	
  Research,	
  September	
  
        2005.	
  
[10]	
  N.	
  SCHÄRLI,	
  Traits	
  —	
  Composing	
  Classes	
  from	
  Behavioral	
  Building	
  Blocks,	
  
        PhD	
  thesis,	
  University	
  of	
  Berne,	
  Feb.	
  2005.	
  
[11]	
  SOFTWARE	
  COMPOSITION	
  GROUP,	
  Traits	
  for	
  Squeak,	
  Smalltalk	
  VM,	
  University	
  
        of	
  Berne,	
  December	
  2006.	
  hOp://www.iam.unibe.ch/	
  scg/Research/
        Traits/index.html.	
  
[12]	
  L.	
  WALL,	
  Apocalypse	
  12:	
  Class	
  Composi;on	
  with	
  Roles,	
  tech.	
  report,	
  The	
  
        Perl	
  Founda@on,	
  2004.	
  hOp://www.perl.com/pub/a/2004/04/16/
        a12.html?page=11.	
  


15/12/10	
                                       Roundup	
  and	
  Conclusion	
                                     40	
  

More Related Content

Viewers also liked

DIL E Governance
DIL E GovernanceDIL E Governance
DIL E Governanceneha.gangal
 
Manua de educacion fisica
Manua de educacion fisicaManua de educacion fisica
Manua de educacion fisicaMINEDU
 
Phing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestraPhing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestraraphaelstolt
 
Gestalt2010 2
Gestalt2010 2Gestalt2010 2
Gestalt2010 2melikian
 
Data Infosys Limited, Jaipur
Data Infosys Limited, JaipurData Infosys Limited, Jaipur
Data Infosys Limited, Jaipurneha.gangal
 

Viewers also liked (9)

Coer2 Intro
Coer2 IntroCoer2 Intro
Coer2 Intro
 
DIL E Governance
DIL E GovernanceDIL E Governance
DIL E Governance
 
Manua de educacion fisica
Manua de educacion fisicaManua de educacion fisica
Manua de educacion fisica
 
PresentacióN
PresentacióNPresentacióN
PresentacióN
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
Phing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestraPhing101 or How to staff a build orchestra
Phing101 or How to staff a build orchestra
 
Gestalt2010 2
Gestalt2010 2Gestalt2010 2
Gestalt2010 2
 
Data Infosys Limited, Jaipur
Data Infosys Limited, JaipurData Infosys Limited, Jaipur
Data Infosys Limited, Jaipur
 
Beyond Frameworks
Beyond FrameworksBeyond Frameworks
Beyond Frameworks
 

More from Stefan Marr

Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Stefan Marr
 
Seminar on Parallel and Concurrent Programming
Seminar on Parallel and Concurrent ProgrammingSeminar on Parallel and Concurrent Programming
Seminar on Parallel and Concurrent ProgrammingStefan Marr
 
Optimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleOptimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleStefan Marr
 
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...Stefan Marr
 
Why Is Concurrent Programming Hard? And What Can We Do about It?
Why Is Concurrent Programming Hard? And What Can We Do about It?Why Is Concurrent Programming Hard? And What Can We Do about It?
Why Is Concurrent Programming Hard? And What Can We Do about It?Stefan Marr
 
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...Stefan Marr
 
Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortStefan Marr
 
Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors
Cloud PARTE: Elastic Complex Event Processing based on Mobile ActorsCloud PARTE: Elastic Complex Event Processing based on Mobile Actors
Cloud PARTE: Elastic Complex Event Processing based on Mobile ActorsStefan Marr
 
Supporting Concurrency Abstractions in High-level Language Virtual Machines
Supporting Concurrency Abstractions in High-level Language Virtual MachinesSupporting Concurrency Abstractions in High-level Language Virtual Machines
Supporting Concurrency Abstractions in High-level Language Virtual MachinesStefan Marr
 
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...Stefan Marr
 
Sly and the RoarVM: Parallel Programming with Smalltalk
Sly and the RoarVM: Parallel Programming with SmalltalkSly and the RoarVM: Parallel Programming with Smalltalk
Sly and the RoarVM: Parallel Programming with SmalltalkStefan Marr
 
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...Stefan Marr
 
Sly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingSly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingStefan Marr
 
The Price of the Free Lunch: Programming in the Multicore Era
The Price of the Free Lunch: Programming in the Multicore EraThe Price of the Free Lunch: Programming in the Multicore Era
The Price of the Free Lunch: Programming in the Multicore EraStefan Marr
 
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...Stefan Marr
 
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...Stefan Marr
 
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...Stefan Marr
 
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...Stefan Marr
 
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...Stefan Marr
 
VMADL: An Architecture Definition Language for Variability and Composition ...
VMADL: An Architecture Definition Language  for Variability and Composition  ...VMADL: An Architecture Definition Language  for Variability and Composition  ...
VMADL: An Architecture Definition Language for Variability and Composition ...Stefan Marr
 

More from Stefan Marr (20)

Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
 
Seminar on Parallel and Concurrent Programming
Seminar on Parallel and Concurrent ProgrammingSeminar on Parallel and Concurrent Programming
Seminar on Parallel and Concurrent Programming
 
Optimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleOptimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with Truffle
 
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...
Tracing versus Partial Evaluation: Which Meta-Compilation Approach is Better ...
 
Why Is Concurrent Programming Hard? And What Can We Do about It?
Why Is Concurrent Programming Hard? And What Can We Do about It?Why Is Concurrent Programming Hard? And What Can We Do about It?
Why Is Concurrent Programming Hard? And What Can We Do about It?
 
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...
Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and w...
 
Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low Effort
 
Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors
Cloud PARTE: Elastic Complex Event Processing based on Mobile ActorsCloud PARTE: Elastic Complex Event Processing based on Mobile Actors
Cloud PARTE: Elastic Complex Event Processing based on Mobile Actors
 
Supporting Concurrency Abstractions in High-level Language Virtual Machines
Supporting Concurrency Abstractions in High-level Language Virtual MachinesSupporting Concurrency Abstractions in High-level Language Virtual Machines
Supporting Concurrency Abstractions in High-level Language Virtual Machines
 
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...
Identifying A Unifying Mechanism for the Implementation of Concurrency Abstra...
 
Sly and the RoarVM: Parallel Programming with Smalltalk
Sly and the RoarVM: Parallel Programming with SmalltalkSly and the RoarVM: Parallel Programming with Smalltalk
Sly and the RoarVM: Parallel Programming with Smalltalk
 
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...
Which Problems Does a Multi-Language Virtual Machine Need to Solve in the Mul...
 
Sly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of ProgrammingSly and the RoarVM: Exploring the Manycore Future of Programming
Sly and the RoarVM: Exploring the Manycore Future of Programming
 
The Price of the Free Lunch: Programming in the Multicore Era
The Price of the Free Lunch: Programming in the Multicore EraThe Price of the Free Lunch: Programming in the Multicore Era
The Price of the Free Lunch: Programming in the Multicore Era
 
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...
Locality and Encapsulation: A Foundation for Concurrency Support in Multi-Lan...
 
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...
Insertion Tree Phasers: Efficient and Scalable Barrier Synchronization for Fi...
 
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...
Encapsulation and Locality: A Foundation for Concurrency Support in Multi-Lan...
 
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...
Intermediate Language Design of High-level Language VMs: Towards Comprehensiv...
 
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...
Virtual Machine Support for Many-Core Architectures: Decoupling Abstract from...
 
VMADL: An Architecture Definition Language for Variability and Composition ...
VMADL: An Architecture Definition Language  for Variability and Composition  ...VMADL: An Architecture Definition Language  for Variability and Composition  ...
VMADL: An Architecture Definition Language for Variability and Composition ...
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Recently uploaded (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

PHP Traits: Horizontal Reuse of Behavior

  • 1. PHP.next:  Traits   Horizontal  Reuse  of  Behavior   Stefan  Marr   AFUP,  La  Can@ne,  Paris   15th  December  2010  
  • 3. Traits  for  PHP  Started  December  2007   15/12/10   3  
  • 4. Today:  Virtual  Machines  for  the  Manycore  Era   hOp://soR.vub.ac.be/~smarr/research/   hOp://github.com/smarr/RoarVM   15/12/10   4  
  • 5. Who  are  you?   •  PHP  Programmer:  Job  or  Hobby?   •  C  Programmer?  (PHP  core/extensions?)   •  Contribu@on  to  Open  Source  projects?   15/12/10   5  
  • 6. Off-­‐Topic…   Anyone  using:   •  COCOMO,  COCOMO  II   •  Func@on  points   •  User  Story  Points   15/12/10   6  
  • 8. Agenda   •  Why  Traits?   •  The  Language  Design   •  Traits  Applied   •  Implementa@on  inside  the  Zend  Engine   15/12/10   8  
  • 9. Reuse  in  Programming  Languages   WHY  TRAITS?   15/12/10   Stefan  Marr  –  PHP.next:  Traits   9  
  • 10. Single  Inheritance   Vertebrates •  Simple  but  not     expressive  enough   •  Leads  to   Dinosaurs Mammal •  Code  duplica@on   •  Inappropriate     hierarchies   Archaeoptrix Bat fly() fly() 15/12/10   Approaches  for  ComposiIon  and  their  Limits   10  
  • 11. Mul@ple  Inheritance   Animal •  Very  expressive   +move() •  But   Bird Swimmer •  Diamond  problem   +move() +move() •  Fragile  hierarchies   +getLegs() Penguin class Penguin { function move() { +move() Swimmer::move(); } } 15/12/10   Approaches  for  ComposiIon  and  their  Limits   11  
  • 12. Mixins   Animal WingAnimal <<mixin>> (1) Bat <<mixin>> (1) bones = light extremity = wings Penguin move() <<mixin>> (2) SwimAnimal extremity = fins move() 15/12/10   Approaches  for  ComposiIon  and  their  Limits   12  
  • 13. Mixins   Animal WingAnimal <<mixin>> (1) Bat <<mixin>> (1) bones = light extremity = wings Penguin move() <<mixin>> (2) SwimAnimal extremity = fins •  Lack  of  composi@on   move() control   •  Fragile  hierarchies   15/12/10   Approaches  for  ComposiIon  and  their  Limits   13  
  • 14. Limita@ons   •  Code  duplica@on   •  Inappropriate  hierarchies   •  Diamond  problem   •  Fragile  hierarchies   •  Lack  of  composi@on  control   15/12/10   Approaches  for  ComposiIon  and  their  Limits   14  
  • 15. Traits  for  PHP   THE  LANGUAGE  DESIGN   15/12/10   Stefan  Marr  –  PHP.next:  Traits   15    
  • 16. Traits   •  Set  of  methods   •  Possibly  composed  of  other  Traits   •  Composi@on  is  unordered   TFoo •  Composi@on  opera@ons   TTrait foo() TBar –  Sum   m1() m2() bar() MyClass –  Exclusion   TConflict –  Aliasing   m2() •  Can  be  flaOened  away   15/12/10   Traits   16  
  • 17. Traits  in  Ac@on   15/12/10   Traits   17  
  • 18. Method  in  Class  Overrides  Trait   Base   foo()   class  Base  {   Code      function  foo()  {  echo  'B';}}   A   T     foo()   foo()   trait  T  {      function  foo()  {  echo  'T';}}   Base     Compiled  Result   foo()   class  A  extends  Base  {      use  T;      function  foo()  {  echo  'A';}}   A   foo()   echo  'A';   15/12/10   Traits   18  
  • 19. Conflicts  are  Explicit   Base   class  Base  {   foo()      function  foo()  {  echo  'B';}}   T1     Code   foo()   trait  T1  {   A      function  foo()  {echo  'T1';}}   T2     foo()   trait  T2  {   Base      function  foo()  {echo  'T2';}}   Compiled  Result   foo()     class  A  extends  Base  {      use  T1,  T2;   A   >>  Fatal  error:     }        collision  on  foo   15/12/10   Traits   19    
  • 20. Solving  Conflicts   Base   class  Base  {   foo()      function  foo()  {  echo  'B';}}   T1   trait  T1  {   Code   foo()      function  foo()  {echo  'T1';}}   A   trait  T2  {   T2      function  foo()  {echo  'T2';}}   !foo   foo()     Base   class  A  extends  Base  {   Compiled  Result   foo()      use  T1,  T2  {          T1::foo  insteadof  T2;      }   A   }   foo()   >>  echo  'T1';   15/12/10   Traits   20    
  • 21. Aliasing   Base   class  Base  {   foo()      function  foo()  {  echo  'B';}}   T1   trait  T1  {   Code   foo()      function  foo()  {echo  'T1';}}   A   trait  T2  {   !foo   T2      function  foo()  {echo  'T2';}}   +foo2   foo()     Base   class  A  extends  Base  {   Compiled  Result   foo()      use  T1,  T2  {          T1::foo  insteadof  T2;          T2::foo  as  fooT2;   A   foo()   >>  echo  'T1';      }   foo2()   >>  echo  'T2';   }   15/12/10   Traits   21    
  • 22. Aliasing  IS  NOT  Renaming   trait  T1  {   class  A  {      function  bar()  {          echo  'T1::bar';      use  T1,  T2  {      }          T2::bar  insteadof  T1;      function  foo()  {          T1::bar  as  bar2;          $this-­‐>bar();      }      }   }   }   trait  T2  {        function  bar()  {   $a  =  new  A;          echo  'T2::bar’;      }   $a-­‐>foo();  //  echo  ??   }   15/12/10   Traits   22    
  • 23. Late  Binding  for  Composability   trait  MovingAnimal  {   class  Penguin  {      function  move()  {      use  WingAnimal,  SwimAnimal  {          $this-­‐>extremities()-­‐>use();          WingAnimal::extremities      }}              insteadof  SwimAnimal;   trait  WingAnimal  {      }      use  MovingAnimal;   }      function  extremities()  {            return  $this-­‐>wings;   $skipper  =  new  Penguin;      }}   $skipper-­‐>move();  //  will  use   trait  SwimAnimal  {                                            his  wings      use  MovingAnimal;      function  extremities()  {          return  $this-­‐>fins;      }}   15/12/10   Traits   23    
  • 24. Traits  and  State   trait  Counter  {      abstract  function  &getValueVar();      function  inc($inc  =  1)  {          $var  =  &$this-­‐>getValueVar();          $var  =  $var  +  $inc;      }}   class  PageWithCounter  {      use  Counter;      public  $counter  =  1;      function  &getValueVar()  {  return  $this-­‐>counter;  }   }   $page  =  new  PageWithCounter;  $page-­‐>inc();   var_dump($page-­‐>counter);   15/12/10   Traits   24    
  • 25. Case  Studies  Illustra@ng  Benefits  of  Traits   TRAITS  APPLIED   15/12/10   Stefan  Marr  –  PHP.next:  Traits   25    
  • 26. Use  Case  for  Traits   •  ezcReflec@on  enhances  PHP  Reflec@on  API   –  Adds  XDoclet  like  annota@ons  for  PHP   –  Enhances  type  hin@ng  using  PHPDoc  type   annota@ons   •  Illustrates  solu@on  for  code  duplica@on   problems   «interface» Reflector ReflectionProperty ReflectionClass ReflectionFunction ReflectionParameter ReflectionObject ReflectionMethod 15/12/10   Traits  Applied   26  
  • 27. Refactoring  ezcReflec@on  with  Traits   15/12/10   Traits  Applied   27  
  • 28. Refactoring  ezcReflec@on  with  Traits   15/12/10   Traits  Applied   28  
  • 29. Implementa@on  details:   Not  to  be  confused  with  language  seman@cs!   The  Traits  Implementa@on   INSIDE  THE  ZEND  ENGINE   15/12/10   Stefan  Marr  –  PHP.next:  Traits   29    
  • 30. Zend  Engine  Overview   PHP  +  Zend  Engine   YACC   Opcodes   Script   Parser   Structures   Opcode   Interpreter   Result   Input   Input   15/12/10   Traits  inside  the  Zend  Engine   30  
  • 31. YACC   Parser   Parser   •  Added  keywords   –  trait   –  insteadof   •  Grammar  rules  based  on  class     15/12/10   Traits  inside  the  Zend  Engine   31    
  • 32. PHP  +  Zend   Engine   Zend  Engine   •  Trait  internally  a  class  with  ZEND_ACC_TRAIT   –  New  data  structures   •  zend_trait_method_reference   •  zend_trait_precedence   •  zend_trait_alias   –  Class  members  added  to  zend_class_entry   •  zend_class_entry  **traits;   •  zend_uint  num_traits;   •  zend_trait_alias  **trait_aliases;   •  zend_trait_precedence  **trait_precedences;   •  Support  in  Reflec@on  API   15/12/10   Traits  inside  the  Zend  Engine   32    
  • 33. Opcode   Interpreter   Interpreter   •  Added  Opcodes   –  ZEND_ADD_TRAIT   •  similar  to  ZEND_ADD_INTERFACE   •  Only  adds  info,  no  composi@on  done   –  ZEND_BIND_TRAITS   •  emiOed  in  zend_do_end_class_declara@on   •  will  ini@ate  trait  composi@on  at  run@me   –  Only  once,  part  of  class  defini@on  process     –  (no  run@me  overhead)   15/12/10   Traits  inside  the  Zend  Engine   33    
  • 34. PHP  +  Zend   Engine   Composi@on  Process   •  Implemented  in  zend_do_bind_traits   1.  Init  traits  data  structures  (resolve  classes)   2.  For  all  used  traits   –  Compile  method  table  of  all  used  methods   –  Respect  exclusion  and  aliases   3.  Merge  resul@ng  tables   4.  Add  methods  to  class   –  Handle  abstract  methods,  inheritance   –  duplicate  func@on  (like  copy/paste,  enables  static)   15/12/10   Traits  inside  the  Zend  Engine   34    
  • 35. ROUNDUP  AND  CONCLUSION   15/12/10   Stefan  Marr  –  PHP.next:  Traits   35    
  • 36. References  for  Traits  in  PHP   RFC:  Horizontal  Reuse  in  PHP   Version  2.0.1,  last  update  2010-­‐11-­‐18   hOp://wiki.php.net/rfc/horizontalreuse     Interes@ng  Blog  Posts   –  Simas  Toleikis:  Overview,  similar  to  RFC   •  hOp://simas.posterous.com/new-­‐to-­‐php-­‐54-­‐traits   –  Sebas@an  Deutsch:  Ac@veRecord  with  Traits   •  hOp://9elements.com/io/?p=28   15/12/10   Roundup  and  Conclusion   36    
  • 37. Conclusion   •  Traits  are  mechanism  for  reuse  of  behavior   •  Avoid  limita@ons  of  other  approaches   –  Avoid  code  duplica@on   –  Enhance  class  composi@on  capabili@es   •  “Compiler  assisted  copy’n’paste”   –  FlaOened  into  class   –  No  run@me  overhead   15/12/10   Roundup  and  Conclusion   37    
  • 38. Basic  Literature  on  Traits   Main  ArIcle  about  Traits     [3]  S.  DUCASSE,  O.  NIERSTRASZ,  N.  SCHÄRLI,  R.  WUYTS,  AND  A.  P.   BLACK,  Traits:  A  Mechanism  for  Fine-­‐Grained  Reuse,  ACM   Trans.  Program.  Lang.  Syst.,  28  (2006),  pp.  331–388.     Traits  Extensions   [1]  A.  BERGEL,  S.  DUCASSE,  O.  NIERSTRASZ,  AND  R.  WUYTS,  Stateful  Traits  and  their   Formaliza;on,  Journal  of  Computer  Languages,  Systems  and  Structures,  34   (2007),  pp.  83–108.   [4]  S.  DUCASSE,  R.  WUYTS,  A.  BERGEL,  AND  O.  NIERSTRASZ,  User-­‐Changeable  Visibility:   Resolving  Unan;cipated  Name  Clashes  in  Traits,  SIGPLAN  Not.,  42  (2007),   pp.  171–190.       15/12/10   Roundup  and  Conclusion     38  
  • 39. Traits  Literature   [1]A.  BERGEL,  S.  DUCASSE,  O.  NIERSTRASZ,  AND  R.  WUYTS,  Stateful  Traits  and  their     Formaliza;on,  Journal  of  Computer  Languages,  Systems  and  Structures,  34  (2007),   pp.  83–108.   [2]S.  DENIER,  Traits  Programming  with  AspectJ,  RSTI  -­‐  L'objet,  11  (2005),  pp.  69–86.     [3]S.  DUCASSE,  O.  NIERSTRASZ,  N.  SCHÄRLI,  R.  WUYTS,  AND  A.  P.  BLACK,  Traits:  A  Mechanism     for  Fine-­‐Grained  Reuse,  ACM  Trans.  Program.  Lang.  Syst.,  28  (2006),  pp.  331–388.   [4]S.  DUCASSE,  R.  WUYTS,  A.  BERGEL,  AND  O.  NIERSTRASZ,  User-­‐Changeable  Visibility:     Resolving  Unan;cipated  Name  Clashes  in  Traits,  SIGPLAN  Not.,  42  (2007),  pp.  171– 190.   [5]S.  MARR  AND  F.  MENGE,  ezcReflec;on,  SVN  Repository,  eZ  Components,  January     2008.  hOp://svn.ez.no/svn/ezcomponents/experimental/Reflec@on.   [6]E.  R.  MURPHY-­‐HILL,  P.  J.  QUITSLUND,  AND  A.  P.  BLACK,  Removing  Duplica;on  from     java.io:  a  Case  Study  using  Traits,  in  OOPSLA  '05:  Companion  to  the  20th  annual   ACM  SIGPLAN  conference  on  Object-­‐oriented  programming,  systems,  languages,   and  applica@ons,  New  York,  NY,  USA,  2005,  ACM,  pp.  282–291.   15/12/10   Roundup  and  Conclusion   39  
  • 40. Traits  Literature   [7]  PROGRAMMING  METHODS  LABORATORY,  Traits  for  Scala,  Programming   Language,  Ecole  Polytechnique  Fédérale  de  Lausanne,  2006.  hOp:// www.scala-­‐lang.org/intro/traits.html.   [8]  P.  J.  QUITSLUND,  E.  R.  MURPHY-­‐HILL,  AND  A.  P.  BLACK,  Suppor;ng  Java  traits  in   Eclipse,  in  eclipse  '04:  Proceedings  of  the  2004  OOPSLA  workshop  on   eclipse  technology  eXchange,  New  York,  NY,  USA,  2004,  ACM,  pp.  37–41.   [9]  S.  REICHHART,  Traits  in  C#.  Video  of  Talk  at  MicrosoR  Research,  September   2005.   [10]  N.  SCHÄRLI,  Traits  —  Composing  Classes  from  Behavioral  Building  Blocks,   PhD  thesis,  University  of  Berne,  Feb.  2005.   [11]  SOFTWARE  COMPOSITION  GROUP,  Traits  for  Squeak,  Smalltalk  VM,  University   of  Berne,  December  2006.  hOp://www.iam.unibe.ch/  scg/Research/ Traits/index.html.   [12]  L.  WALL,  Apocalypse  12:  Class  Composi;on  with  Roles,  tech.  report,  The   Perl  Founda@on,  2004.  hOp://www.perl.com/pub/a/2004/04/16/ a12.html?page=11.   15/12/10   Roundup  and  Conclusion   40