Immutability from experience: part 2

Disclaimer: I am not an expert on this matter, but I would like to share my thoughts and experience with immutability and why I believe more people should be using it.

Part 2: Applying it to Software

(1) Final, constants by default

Immutable by default, mutable by choice

(2) Naive vs Defensive copying

String a = customObj.getField()
Deep Copy vs.Shallow Copy

(3) Only constructors and getters

Summary 🔖

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store