Sunday 30 January 2011

Java and Immutability Explained

Duke WavingImmutability is a topic that has come up a lot at work in regard to threading. Since I really didn't understand what that meant in a programming context, I did what any aspiring developer should do. I wrote some code. So you can read my little write ups on the subject at the following links.



Java and Immutability Part I

Java and Immutability Part II



So what did I learn? That an immutable object is really just a read only object. But when it comes to reference variables, read only is a little tougher to achieve than one might think.



Source code is included. Please let me know if I screwed anything up. :)

No comments:

Post a Comment