Skip to content

Just as it is a good practice to make all fields private…

“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

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

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.

★ ★ ★ ★ ★ No ratings yet

More by Brian Goetz

Explore all 13 Brian Goetz quotes

More Concurrency quotes

Browse all 13 Concurrency quotes