File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 78
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.


    SCEA, PMP, read my blog: www.yegor256.com
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Objects Should Be Immutable