Source

pycon2013 / api-design.txt

Full commit
- library: no state (or very little) and no callbacks
- guidelines
    1. Mode state is precious
    2. Don't design exclusively for convenience 
    3. Avoid knobs on knobs
    4. Composing > Inheriting

[1]
    - import changes global state (even if you don't use anything)
        - mp, logging
    - What happens when you call "init" the 2'nd time?
    - What can happen before __main__ and after it?
    - Push state outside (see quote)

[2]
    - flask/pylons request which appears global but is per request
    - If it makes it harder to write tests - people will write less tests
    - Convenience != Cleanliness 

[3]
    - knob: replaceable component (like DEBUG flag)
    - It confuses people
    - Remove or hide

[4]
    - The Yo-Yo Problem (class graph is too complex)
    - Smells slide (Inheritance Considered Harmful)
    - In composition the contract is more "formal"
    - If you offser superclass, make most (all?) methods abstract