DEV Community

Discussion on: How state makes software complex

Collapse
 
matthewdailey profile image
Matt Dailey

Great summary! I've historically programmed in Java, and thinking with immutable objects by default really helps keep down complexity of things like API code. We once had a mutable class whose objects were created when the API request was received, was enriched by data from the DB, then changed again before making another API call, and tracking that mutability was a nightmare when debugging

Collapse
 
kiraemclean profile image
Kira McLean

Haha yes I've been there :) Not with Java specifically, but a lot of JavaScript and Ruby libraries sneakily mutate things behind the scenes and it is indeed a nightmare to debug! And thank you!