Skip to content

ArjanCodes/2021-composition-vs-inheritance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Why composition is better than inheritance

This repository contains the code for the Composition vs Inheritance video on the ArjanCodes channel (watch the video here).

The example is about different employee types and reward structures. In the first version (before.py), there is no inheritance, just three classes (= three employee types) with low cohesion (lots of responsibilities per class), and code duplication. Then there is a version that tries to solve those issues with inheritance (with_inheritance.py), and another version that uses composition (with_composition.py).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages