Design Patterns - Composite

Software Engineering
1.0x

Design Patterns - Composite

Created 3 years ago

Duration 0:02:52
lesson view count 518
Select the file type you wish to download
Slide Content
  1. Design Patterns: Composite

    Slide 1 - Design Patterns: Composite

    • Emerson Murphy-Hill
  2. Composite Pattern

    Slide 2 - Composite Pattern

    • Tree structure
    • Represents whole-part relationships of objects in a system
    • Treat individual and composite objects the same way
    • Example
    • Directories could contain files (leaves) or more directories
  3. Composite UML

    Slide 3 - Composite UML

  4. Composite Structure

    Slide 4 - Composite Structure

    • Component
    • Interface for leaf and composite objects
    • Leaf
    • Not a container
    • Implements component methods
    • Composite
    • Container of other composites or leaves
    • Collection of children
    • Has methods that manipulate children
    • Add or remove from the collection
    • Delegates component methods to children
    • Iterates over children and calls their component methods