Last active
June 9, 2019 15:47
-
-
Save jonascheng/9722129b50e5b7abb8391e4a50384bb6 to your computer and use it in GitHub Desktop.
SOLID-SerializedEmployeeClass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
class MySQLStore: | |
def connect(self): | |
print('connect to mysql database') | |
def serialize(self, first_name: str , last_name: str, birth: datetime, hourly_rate: int, labor_hours: int): | |
print('serialized data to mysql database') | |
class Employee: | |
// ... | |
def save(self): | |
db = MySQLStore() | |
db.connect() | |
db.serialize(self._first_name, self._last_name, self.birth, self._hourly_rate, self._labor_hours) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment