stories
stories copied to clipboard
Story methods should not understand data semantics.
def a1s1(self, state):
if self.user.last_login > timezone.now() - timedelta(days=30): # bad
...
def a1s1(self, state):
if self.user.is_active(): # good
...
We should not couple shape of data and the way we interpret it to the story definition.
Keep that knowledge to the entities layer.
Entity classes should:
- Force private classes (via generics library).
- Force entities to use attrs frozen.
- Deny validators and converters (use state contract instead).
Suggest to try https://github.com/hchasestevens/bellybutton for this restrictions.