stories icon indicating copy to clipboard operation
stories copied to clipboard

Story methods should not understand data semantics.

Open proofit404 opened this issue 4 years ago • 0 comments

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.

proofit404 avatar Mar 24 '21 22:03 proofit404