index

means: small classes


To ensure that an interface makes the implementation as easy as possible, it needs to be minimal. The interface should provide all the operations that its clients might need, but no more.
[ hqse, p.12]

A small public interface is easier to reuse and easier to upgrade. An indicator of properly decoupled code.
class   Sequence { 
public: Sequence(); 
  SeqItem before(doub) const; // extrapolate for t < T0. 
  SeqItem  after(doub) const; // extrapolate for t > T1. 
  inline int     fps() const  {return fps_;} 
  inline int    size() const  {return seq_.size();} 
  inline SeqItem &item(int i) {return seq_[i];}    // nth item. 
  inline void      fps(int n) {fps_ = n; inval();} // frames per sec. 
  inline void  reserve(int n) {seq_.reserve(n);} 
  inline void  resize (int n) {seq_.resize (n);} 
  static void  save(Sequence*, cchar*); 
  static void  load(Sequence*, cchar*); 
  void inval() {seq_.resize(0);}                   // invalidate. 
private: 
  // ** implementation details ** 
};

Branching


nedwaves.com 2017 [171108]