Daily Archives:December 21st, 2017

Some Thoughts on Object-Oriented Design

Apress Beginning Python From Novice to Professional

Gather what belongs together. If a function manipulates a global variable, the two of them might be better off in a class, as an attribute and a method.

Don’t let objects become too intimate. Methods should mainly be concerned with the attributes of their own instance. Let other instances manage their own state.

Go easy on the inheritance, especially multiple inheritance. Inheritance is useful at times but can make things unnecessarily complex in some cases. And multiple inheritance can be very difficult to get right and even harder to debug.

Continue Reading

© 2006-2018. Powered by WordPress Romangie & Bootstrap. ICP No. 15008795