Class with no encapsulation
Everything public, no validation. What would a senior flag FIRST in a payments-domain review?
The snippet
# A "model" with everything public and no validation.
class Order:
def __init__(self, items, total):
self.items = items
self.total = total
def add_item(self, item, price):
self.items.append(item)
self.total = self.total + price
def apply_discount(self, percent):
self.total = self.total - self.total * percent / 100