Writing modular and re-usable code make maintenance and development easier. This blog post we explore how to write OO code that allows to achieve this objective
Writing modular and re-usable code make maintenance and development easier. This blog post we explore how to write OO code that allows to achieve this objective
Summary of PyGotham 2014 Talk
Advantages of having OO Code:
If you have one giant class with lot of functions has some disadvantages:
Refacto to following classes:
def calculate(self):
cost = 0
for line_item in self.bill.items:
cost += line_item.cost
# Better way
def calculate(self):
cost = self.bill.total_cost()