Evaluating bids

Desenvolvimento validação herança vs composição python

Published on the February 16, 2023 in IT & Programming

About this project

Open

Topics:

Duck typing
Diamond Error with multiple inheratice using Python MRO to avoid this error
The classes explosion problem when utilize inheratice
What is better Composition or Inherit
The type of relationships 'Is a' and 'Has a'
When you should choose Composition or Inherit
Using mixin to add behavior for classes already implemented
Refactoring using factory pattern
Refactoring using singleton pattern
Resume when choose one design:

Use inheritance over composition in Python to model a clear is a relationship. First, justify the relationship between the derived class and its base. Then, reverse the relationship and try to justify it. If you can justify the relationship in both directions, then you should not use inheritance between them.

Use inheritance over composition in Python to leverage both the interface and implementation of the base class.

Use inheritance over composition in Python to provide mixin features to several unrelated classes when there is only one implementation of that feature.

Use composition over inheritance in Python to model a has a relationship that leverages the implementation of the component class.

Use composition over inheritance in Python to create components that can be reused by multiple classes in your Python applications.

Use composition over inheritance in Python to implement groups of behaviors and policies that can be applied interchangeably to other classes to customize their behavior.

Use composition over inheritance in Python to enable run-time behavior changes without affecting existing classes.

Project overview

https://github.com/rafaelhfreitas/inheratice

Category IT & Programming
Subcategory Web development
What is the scope of the project? Medium-sized change
Is this a project or a position? Project
I currently have Not applicable
Required availability As needed
API Integrations Other (Other APIs)
Roles needed Design a landing page, Developer, Business analyst, Project manager

Delivery term: Not specified

Skills needed