Concurrency Quote by Brian Goetz
““Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make all fields final unless they need to be mutable.””
About This Quote
Source Book: Java Concurrency in Practice, 2006
Encourage encapsulation and immutability to reduce bugs and improve maintainability.
In simple terms: Make fields private and final unless needed otherwise.
Design for safety and clarity.
Themes
Mood
Type
When to use this quote
- API design
- team code reviews
- library development
- teaching OOP
Key Concepts
Questions to Reflect On
- When should a field be mutable?
- How does immutability affect performance?
Overuse of final can hinder flexibility in some patterns.