JTraining Blog

A short description about your blog
ppow
ppow Internationalization of a project in Java does not have to be confusing. It can even be quite simple if you have the appropriate tools to work with. One of the basic ones and quite powerful is the MessageFormat class. With this class you can in an easy and effective way create custom messages presentable to the user. It allows to precompile the message template (therefore increasing the performance), add custom formating to variables used by the message and also benefit from Locale specific formatting rules. For a simple intro to what is MessageFormat see this post on JavaBlogging!

Tagged in: Untagged 
ppow
ppow You may not be aware, but there are tons of pitfalls and corner cases in Java that can make your code fail unexpectedly. One of them is the equals() method in java.net.URL. See how easily it can change its result in the following post on JavaBlogging.com

Tagged in: Untagged 
ppow
ppow You probably know what a catalyst is, but since Java has nothing to do with chemistry you would not expect to find one in it, right? Wrong! See how can you write a catalyst method in Java - a method that never is invoked but its existence change the program behavior.

Tagged in: Untagged 
ppow
ppow A simple story about a one design decision taken lightly that can bite you in behind... In a given code example when do you write a Comparator and where implement Comparable?

Tagged in: Untagged 
ppow
ppow You probably know the FindBugs tool that can analyze your java code and help you find some of the common bugs. Are you aware that there is a plugin for Eclipse integrating FindBugs with your favorite IDE? It's really (I mean it) easy in usage and installation and can help you avoid hours of debugging. For an instruction how to install it and use check out this article.

Tagged in: Untagged 
ppow
ppow This may come as a shock to you, but comparing Integers in Java is not as simple as you might think... A description of common bug in implementation of 'compareTo()' method is shown in 'Few words on how to compare integers' post on Javablogging.

Tagged in: Untagged 
ppow
ppow Many developers focus their attention on using in their project various extraordinary platforms, engines, libraries or advanced development tools. It is very easy to get distracted by those and fail to notice all the small stuff that can blow up your application and ruin your whole day. How well do you know Java String class? Even though you read the JavaDoc several times you might get into a situation when such a simple class will bite you in yours behind... Are you sure your strings are splitting right?

Tagged in: Untagged 
ppow
ppow It is extremely tempting for a programmer to write a simple micro benchmark just to check whether or not one piece of code is faster than another. Even though it seams reasonable in 99% of cases it leads to bias results and/or unreliable measurements. As it turns out benchmarking in Java can be really difficult. Check out this post about "Writing micro benchmarks in Java" on what kind of pitfalls you may encounter during benchmarking...

Tagged in: Untagged 
ppow
ppow

Probably most of the Java users is aware that String object is more complex than just an array of char. To make the usage of strings in Java more robust additional measures were taken – for instance the String pool was created to save memory by reusing the same String objects instead of allocating new ones.

Another optimisation that is adding the offset and count fields to the String object instances to improve the performance of substring() method. Even though this mechanism is very helpful in practice, not many people are aware how easily you can create a major memory leak because of that! (check out this article if you're interested). It is funny how in Java even simpliest stuff can bite you in your behind:)


Tagged in: String , Memory , Leak , Java SE

Tags:

Sponsers