Friday, April 26, 2013

Interesting Java Blog Posts in Mid-April 2013

There have been numerous Java-related blog posts in recent days and I reference and summarize four of them here.

Creating a Memory Leak

In the "rather evil post" How to Create a Memory Leak, Ivo Mägi describes and provides code examples of two commons leaks. The first leak covered is related to objects lacking the hashCode()/equals(Object) implementations to be used properly in collections needing them to be correct. The second covered leak is related to the change of handling for String internals in Java 7 Update 6. The second problem is a reminder of the subtle and difficult to diagnose issues that can occur when even minor differences exist between versions of Java used in different environments.

StringBuffer Was Never a Good Idea

Peter Lawrey's blog post Why a synchronized StringBuffer was never a good idea articulates something I've found to be the case: most uses of building up strings do not need to be thread safe. Even when thread safety is needed, Lawrey points out why StringBuffer often is not sufficient.

9 Fallacies of Java Performance

Ben Evans looks at 9 Fallacies of Java Performance including the outdated mantra "Java is slow" and problems with using microbenchmarks to make performance decisions. He points out that "Java performance-tuning intuition is often misleading" and that "we require empirical data and tools to help us visualize and understand the platform's behavior."

Infamous Java Bugs and Pitfalls

Murat Yener has collected some Java-related "bugs and pitfalls" in his post Infamous Java Bugs and Pitfalls such as autoboxing issues and BigDecimal quirks.

Conclusion

The four blog posts on Java cited above have been recently posted and provide good reminders and potentially new information on things to be cognizant of when developing with Java.

No comments: