Skip to content

Resolve "Composition over Inheritance"

d.kilic requested to merge 85-composition-over-inheritance into master

This MR includes:

  • TrackPoint is now a struct (since it has no class invariant)
  • TrackPerson doesn't inherit from QList anymore, but instead has a std::deque member variable for its points
  • Tracker doesn't inherit from QList anymore, but instead has a std::vector member variable for its TrackPersons
  • Adjustments to the interface of TrackPoint, TrackPerson and Tracker so that the code still works

This MR does not close #85, since the real pendant (TrackerReal & Co) are not yet migrated to work via member variables.

I also want to note, the change is done really rudimentary here. So the API of the classes is still not preserving all class invariants (e.g. one still could add an Point to a Person without updating its member last_frame). But adding that to this MR would result in a too big difference.

This MR changes interfaces of commonly used classes, so it should be communicated to all devs before merging. Also, it is more prone to complicated merges because of that, so it may be reviewed when no merge is planned for the near future.

Relates #85

Merge request reports