Minimizing side effects
- C++: clearly separate methods without side effects (const method) from ones with side effects
- Minimize number of non-const methods: ** Scenario 1: a() and b() are both non-const methods; b()'s side effect only affects one member variable; a() calls b() => Make b() const and return the new value of the member variable. In a(), instead of calling b(), set member variable var_ = b();
last updated december 2011