Classes and the DRY principle

Software Engineering Principles in Python

Adam Spannbauer

Machine Learning Engineer at Eastman

Creating a SocialMedia Class

  Social Media Class File

Software Engineering Principles in Python

The DRY principle

DRY Umbrella

Software Engineering Principles in Python

The DRY principle

DRY Umbrella

Software Engineering Principles in Python

The DRY principle

DRY Umbrella

Software Engineering Principles in Python

The DRY principle

DRY Umbrella

Software Engineering Principles in Python

Intro to inheritance

  Inheriting from Document Class

Software Engineering Principles in Python

Inheritance in Python

Inheritance Structure

Software Engineering Principles in Python

Inheritance in Python

# Import ParentClass object
from .parent_class import ParentClass

# Create a child class with inheritance class ChildClass(ParentClass): def __init__(self): # Call parent's __init__ method ParentClass.__init__(self)
# Add attribute unique to child class self.child_attribute = "I'm a child class attribute!"
# Create a ChildClass instance child_class = ChildClass() print(child_class.child_attribute) print(child_class.parent_attribute)
Software Engineering Principles in Python

Let's Practice

Software Engineering Principles in Python

Preparing Video For Download...