7 Reducing complexity of state

This chapter covers

  • Making entities partially immutable
  • Using entity state objects
  • Looking at entities through entity snapshots
  • Modeling changes as a relay of entities

If mutable state isn’t handled properly, bad things happen. For example, a flight taking off with a bag in the hold belonging to a passenger who never showed up for boarding might be a security risk. But keeping the state of entities controlled becomes hard when entities become complex, especially when there are lots of states with complex transitions between them. We need patterns to deal with this complexity, to reduce it in a manageable way.

On top of the problems with complex mutable states, entities are also hard to code. This is because ...

Get Secure by Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.