Javarevisited
Published in

Javarevisited

Is Java Concurrency in Practice Still Valid in 2022?

TL: DR — Yes, Java Concurrency in Practice is still valid and one of the best books to learn Java multithreading and concurrency concepts. However, an updated version would be great.

Is Java Concurrency in Practice Still Valid

Hello guys, if you are wondering whether one of the famous Java books, Java Concurrency in Practice is valid in the era of Modern Java of functional programming or not then you are not alone, many Java developers have similar doubts.

One of my readers Shobhit asked this question on my blog post about 12 must-reads advanced Java books for intermediate programmers — part1.

I really liked the question and thought that many Java programmers might have the same doubt whenever someone recommends them to read Java Concurrency in Practice.

When this book came first in 2006, the Java world was still not sure of new concurrency changes made in Java 1.5, I think the first big attempt to improve Java’s built-in support for multi-threading and concurrency.

Many Java programmers were even not aware of new tools introduced in the API like CountDownLatch, CyclicBarrier, ConcurrentHashMap, and much more.

The book offered them the seamless introduction of those tools and how they can use them to write high-performance concurrent Java applications.

This is the general view of the book, which many Java developer will give you when you asked them about how did you find “Java Concurrency in Practice”, but mine view is slightly different from them and that’s the main reason I still recommend Java Concurrency in Practice to any new Java developer or intermediate developers who want to master concurrency concepts.

Btw, I found a lot of developer struggle to comprehend the concepts, if you are also one of them, I suggest you also join Java concurrency course by Heinz Kabutz Java champion which explains this book in a very nice way. The course is no doubt expensive but its worth it

The most important thing this book introduce was clear concepts and fundamentals of concurrent programming like visibility, ordering, thread-safety, immutability, parallelism, etc.

Why Java developers should read Java Concurrency in Practice

It also goes on to explain why most concurrent applications are incorrectly written in Java and the common mistakes made by Java programmers which result in multi-threading issues like race conditions, deadlock, livelock, memory interference, and simply incorrect calculation.

Emoticons are used to show the bad practice before introducing the good and right way to do helped a lot not only to correct the misconception many Java developers had before but to sow the seed of right information pertaining to multi-threading and concurrency among Java developers.

No doubt that multi-threading and concurrency are difficult, they are both hard to get right in code and hard to understand and explain. I have seen many programmers who simply weren’t able to visualize how multiple threads are interacting with the same piece of code with different data.

Much like the classical concept of recursion which is too easy for some programmers but too difficult for others to grasp and apply in the real-world scenario.

The biggest contribution of the Java Concurrency in Practice to the Java world is not making concurrency easy but providing the correct and clear information which was lacking. Since I have taken a lot of interviews, I know that programmers always have misconceptions about threads and how they work.

Is Java Concurrency in Practice Still Valid

Many programmers even with 4 to 5 years of experience in Java didn’t understand how volatile variable works, what they know is that when you use a volatile variable it always checks the value from main memory while comparing, which is the truth but not complete.

They were not told about the Java memory model and how volatile variables can affect the ordering of code and computing instructions behind code by JIT and JVM for optimization which could result in subtle logical bugs.

They were not made aware of how volatile can guarantee the visibility of what was done by one thread prior to accessing volatile variables to another thread etc. They don’t know what is a memory barrier and how does it impact visibility.

The Java Concurrency in Practice book teaches those concepts to many Java programmers. In fact, I would admit that before reading that book, I have lots of misconceptions about many essential multi-threading and concurrency concepts e.g. ordering, visibility, and subtle effect of final variables and safe publication, the book helped me to clear those.

Btw, if you find some sections of the book difficult to understand then you are not alone, but thankfully Dr. Heinz Kabutz has simplified them in his Java Concurrency in Practice Bundle course.

Java Concurrency in Practice Course

If you think even that is tough then Mastering Threads is another course by Heinz, which simplifies the multithreading for the average Java programmer. He is also offering a 30% discount until the 19th of February.

Now, coming back to Java 8, yes from Java 1.5 to Java 8, JDK has a lot more new tools to implement concurrency and design better Java concurrent applications. The introduction of the fork-join pool in JDK 7, CompleteableFutures in Java 8, and most importantly the new functional style of coding in Java 8 supported by the lambda expression.

You also got the stream and parallel stream which allows developers to take advantage of concurrency without coding it. The overall idea of moving concurrency from application developers to API developers also makes it a little easier and reduced the risk of implementing concurrency in Java.

It also means that now you can perform the bulk operation in Java with just a couple of methods and multiple threads without writing a single line of code involving threads, synchronized keywords, or wait-notify methods.

No doubt, that Java developer has to learn these new tools to keep themselves up-to-date and a book like Java 8 in Action (also known as Modern Java in Action) really helps on that front. It introduces you to all new changes in Java 8 and not only teaches you how to use them in your day-to-day task but also explains the motivation behind them to understand the bigger picture.

best book to learn Java 8

Even though Java Concurrency in Practice in its current state doesn’t cover all these important concepts and tools, it’s still an invaluable book to learn the fundamentals of threads, concurrency, and multi-threading tools supported by the Java programming language.

It’s still a must-read book for any Java developer who wants to learn and master multi-threading and concurrency, the biggest advantage of using Java for application development.

Java developers are thankful to Brian Goetz, Joshua Bloch, and all the authors for giving Java developers such an authority book to understand the confusing but critical concepts of multi-threading and concurrency.

Having said that, like many Java developers around the world, I would also love to see a newer, more up-to-date version of Java Concurrency in Practice to cover tools and methodologies introduced in Java 6, 7, 8, 9, 10, 11, 12 13, 14, 15, 16, 17 and maybe in Java 18 in coming months, much like the updated version of Effective Java and Head First design pattern which covers Java 8 and teaches you how certain patterns are easier to implement with new Java 8 features.

Other Java Articles You May Like to Explore
The Complete Java MasterClass
10 Testing Tools Java Developers Should Know
10 Advanced Core Java Courses for Experienced Programmers
5 Frameworks Java Developers Should Learn
Top 5 Courses to learn Multithreading and Concurrency
Finally, Java has var to declare Local Variables
10 Advanced Java Books for Experienced Programmers
10 Things Java and Web Developer Should Learn
10 Books Every Java Programmer Should Read
Top 5 Courses to become full-stack Java developer
10 Tools Java Developers uses in their day-to-day work
Top 5 Courses to learn Java Multithreading in depth
Applying Concurrency and Multi-threading to Common Java Patterns

Thanks for reading this article so far. If you also love to see a new and updated version of Java Concurrency in Practice then please share this article on Facebook and Twitter and maybe our request will reach Brian and the publisher of the book.

P.S. — Let’s hope Brian Goetz and other authors of the book listen to this request and gift Java developers around the world with a new version of Java Concurrency in Practice this year until then Dr. Heinz Kabutz’ Java Concurrency in Practice Bundle can be used to keep yourself up-to-date.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
javinpaul

javinpaul

23K Followers

I am Java programmer, blogger, working on Java, J2EE, UNIX, FIX Protocol. I share Java tips on http://javarevisited.blogspot.com and http://java67.com