1. Review of concepts so far
    1. CPU model
      1. Sequential instructions
      2. Fixed-cost ALU
      3. Random memory expensive
      4. Unpredictable branches expensive
    2. Structure of Arrays
      1. Object contains arrays of things
      2. Good for cache (access locality, avoid cache pollution)
      3. Good for uniform objects
    3. Components
      1. Decompose object into component objects
        1. Components promote code reuse between object types!
        2. Components allow more flexible relationships
      2. Components organized in dense arrays
        • Good for cache, less branching
      3. Object is ID
      4. Mapping between object ID and component IDs
  2. Component variations
    1. Can have list of components per object
      • make it easier to tell what you have
    2. Variations to map Object ID to Component ID
      1. map
        • Log(N) lookup, not as cache friendly
      2. unordered_map / hash_map
        • Constant time (w/ good hash), not as cache friendly
      3. list
        • Linear (small) or binary search
    3. Pointers vs. handles
      1. Especially std::vector resize moves pointers
      2. If everything is dense arrays, use array index as handle instead
      3. More reliable for serialization
    4. serialization = save & restore state
      1. As read/write functions (often << and >> in C++)
      2. As function that does both depending on istream vs. ostream
      3. As auto-generated functions
      4. Great even for computational code
        • Allow restart!
  3. Managers
    1. Function that operates on a component
    2. Doesn't care what objects hold the component
    3. Common to have inheritance in Managers
      1. Init/Shutdown (separate from constructor)
        1. Allows game restart w/o allocate & delete
        2. Can rely on construction of other components
        3. Unity: Construct, Awake, Start, Reset
      2. Update
        1. Call when updates need to happen
        2. Can be per frame, per physics update, other
      3. Send/Receive message
    4. Message = generic state tracking
      1. Component can post message
        1. Activate, ApplyDamage, ...
        2. Can broadcast
        3. Can apply locally (children, parents, nearby)
      2. Component can act on message
        1. Member function by name (Unity)
        2. enum input to ReceiveMessage call
      3. Replay message stream can replay game
        1. Great for debugging & repro