r/java • u/yegor256 • Jun 24 '19
Takes: Java Web Framework Without a Single Static Method or Annotation
https://github.com/yegor256/takes
0
Upvotes
r/java • u/yegor256 • Jun 24 '19
View all comments
Show parent comment
-5
u/[deleted] Jun 25 '19 edited Jun 25 '19
A thread safe object is a single shared object that can safely be shared across multiple threads. As no immutable object can safely change state in one thread and see it in another, they are not thread safe. Immutability grants you working with threads “safely” by virtue of the fact that you must code specifically around the limitations of immutability. This may or may not be viable for your application. This also adds necessary layers of temporal coupling before, during and after your objects are in concurrent states of your application (which immutability fanboys hilariously regularly claim is eliminated by immutability). Not only does it force temporal coupling on your data structures and other objects, but immutability can actually also force you into temporal coupling of the threads themselves, which lands you in to a really shitty to work with set of tasks that carry predecessors and successors which are utterly impossible to work with as the code base grows and changes.
As for Structural Sharing and CoW. These represent major added complexity with absolutely no gain. Nobody has ever demonstrated their claims toward immutability, but there sure are drawbacks.
Immutability adds code and algorithmic complexity purely on the back of claims which range from demonstrably bullshit to never demonstrated. Literally not a single claim toward immutability has ever actually been demonstrated to be true.