File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Blog around the Campfire and the fly likes Objects Should Be Immutable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "Objects Should Be Immutable" Watch "Objects Should Be Immutable" New topic

Objects Should Be Immutable

Yegor Bugayenko
Ranch Hand

Joined: Feb 11, 2011
Posts: 79
Hi all,

Please check this blog post:

In this short article I give a few arguments in favor of object immutability. In short, here is a list of them:

  • immutable objects are simpler to construct, test, and use
  • truly immutable objects are always thread-safe
  • they help to avoid temporal coupling
  • their usage is side-effect free (no defensive copies)
  • identity mutability problem is avoided
  • they always have failure atomicity
  • they are much easier to cache

  • Would be great to hear your comments. Thanks.

    SCEA, PMP, read my blog:
    I agree. Here's the link:
    subject: Objects Should Be Immutable
    It's not a secret anymore!