Skip to main content

Home/ Coders/ Group items tagged traits

Rss Feed Group items tagged

Fabien Cadet

Traits: The else-if-then of Types, by Andrei Alexandrescu - 3 views

  • Definition: A traits template is a template class, possibly explicitly specialized, that provides a uniform symbolic interface over a coherent set of design choices that vary from one type to another.
  • An important use of traits is as "interface glue"—universal non-intrusive adapters. If various classes implement a given concept in slightly different ways, traits can fit those implementations to a common interface.
  • Definition: A traits class (as opposed to a traits template) is either an instantiation of a traits template, or a separate class that exposes the same interface as a traits template instantiation.
  • ...3 more annotations...
  • traits with state
  • general-purpose traits
  • hierarchy-wide traits—traits that you can define in one shot not just for a class, but for a whole hierarchy or subhierarchy.
  •  
    "Traits: The else-if-then of Types"
anonymous

jstraits - 0 views

  •  
    A traits library/framework for JavaScript.
anonymous

Traits - 0 views

  •  
    Traits are a simple composition mechanism for structuring object-oriented programs. A Trait is essentially a parameterized set of methods; it serves as a behavioral building block for classes and is the primitive unit of code reuse. With Traits, classes are still organized in a single inheritance hierarchy, but they can make use of Traits to specify the incremental difference in behavior with respect to their superclasses. Unlike mixins and multiple inheritance, Traits do not employ inheritance as the composition operator. Instead, Trait composition is based on a set of composition operators that are complementary to single inheritance and result in better composition properties.
1 - 4 of 4
Showing 20 items per page