Expensive creation of a Java instance

Execute this code in your Java program:

SimpleDateFormat df = new SimpleDateFormat();

Here are the consequences:

  • 55 distinct methods are called a total of 123 times
  • 44 new instances of objects are created

That is one badly-designed class. And that's before considering the non-thread-safety of SimpleDateFormat that leads it to be probably the #1 cause of concurrency issues in Java programs. And which prevents reusing one instance across an entire application.

I sourced this here.



Popular posts from this blog

WordPress comments can never be really disabled

Ask Customers for Money Already...

T-10: But Retina is Different...