Skip to content

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.” quote by Brian Goetz
Download Open image
““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.””

Brian Goetz

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.

Key Takeaway

Design for safety and clarity.

Themes

encapsulation immutability software design

Mood

practical technical

Type

guideline advice

When to use this quote

  • API design
  • team code reviews
  • library development
  • teaching OOP

Key Concepts

Object-oriented principles defensive programming

Questions to Reflect On

  • When should a field be mutable?
  • How does immutability affect performance?
A Different Perspective

Overuse of final can hinder flexibility in some patterns.

3.2 out of 5 (10 ratings)

More by Brian Goetz

Explore all 13 Brian Goetz quotes

More Concurrency quotes

Browse all 13 Concurrency quotes