aspose file tools*
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
Author

Objects Should Be Immutable

Yegor Bugayenko
Ranch Hand

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

Please check this blog post: http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html

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.


    follow me at yegor256.com
     
    jQuery in Action, 2nd edition
     
    subject: Objects Should Be Immutable