It makes the code icky and hard to debug, and you can simply return new immutable objects for every state change.

EDIT: why not just create a new object and reassign variable to point to the new object

  • @[email protected]
    link
    fedilink
    1017 hours ago

    There are times when immutable objects are absolutely the way to go from a data safety perspective. And there are other times when speed or practicality prevail.

    Never become an extremist about any particular pattern. They’re all useful - to become a master you must learn when that is.