Java Forum Stuttgart – Part 3

This is the last post of my visit at the Java Forum Stuttgart. In Part 1 and Part 2 I described the other talks I attended at the JFS 2016. In this post I will present the remaining talks I attended.

Erhöhe i um 1

This topic was a replacement for another talk where the speaker was not able to attend the conference. Michael Wiedeking again gave an entertaining talk about comments in code, especially comments like i = i + 1; // Increase i by 1. He also discussed the difference between API documentation, like JavaDoc, and normal in-line comments. His resume was that instead of writing comments, one should invest time in better readable names.

Another interesting part of the talk covered different types of interfaces. He splits interfaces into three types.

  1. unchangeable public interfaces
  2. changeable public interfaces
  3. private interfaces

Type 3 is the least problematic one. This type is only used to encapsulate different parts of our software internally. Changing parts of type 1 interfaces is like changing a normal class. It is just a refactoring, because the developer checked out all usages of the interface. Type 2 interfaces are used in-house or by a small number of users, which are known by the developer. A change in this kind of interface is a bit more problematic, but with good reasons it is acceptable, because only few people have to change their software. Nonetheless it should be avoided. Type 1 interfaces are the most problematic ones, because they are published to a wide audience and used by a lot of developers world wide. A good example for this is the JDK. Changing interfaces or the visibility of interfaces of type 1 is nearly impossible. Every change of an interface of this type will break a huge number of builds and is therefore not acceptable.

Was jeder Java-Entwickler über Strings wissen sollte

This talk was held in the fashion of What every Java Programmer should know about Floating Point Arithmetic and revealed some interesting insights of Strings in Java. Before presenting those insights, the speaker gave a short introduction into measuring the performance of Java programs. This part is mainly based on blog posts from Antonio Goncalves, the book Java Performance written by Scott Oaks, and Quality Code written by Stephen Vance. Performance in Java is best measured using the Java Microbenchmarking Harness which is developed with the OpenJDK. It allows to analyze programs in scales down to nano- and microseconds and provides support to warm up the JIT compiler.

After this introduction to measuring performance in Java, the presenter shows the impact of String#intern. This function moves the content of a String into a StringTable and only saves a reference to the content. Due to this, two Strings having the same content, only need the memory space one time for the content and two times for the references to the content. Depending on the application, this could reduce the memory footprint significantly. If you want to analyze this, you can use –XX:-PrintStringTableStatistics as a command line argument. Together with the introduction of the G1 garbage collector (-XX:+UseG1GC), the String deduplication could be activated by -XX:+UseStringDeduplication.

This and that

Between the talks and on the way to and from the Java Forum there were a lot of other interesting talks. All in all it was a nice experience and I will reserve the date for the next Java Forum in my calender.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s