The usual way an instance of a class lives is as follows

  1. An instance is constructed, usually provided with all the information it needs in the constructor call (or shortly after) that it will need to perform its function successfully.

  2. The instance lives for a time, and is called on to perform its function.

  3. The instance has performed its function, and goes out of scope.  The programmer does not need to manage it anymore.

Once these basic principles are broken, the maintainability of class decreases.  For example, it can be tempting to start processing immediately by calling another method from the constructor, which can cause unexpected behavior.


blog comments powered by Disqus