Monday, November 26, 2012

JavaFX: Leveraging Multi-core Performance

Like many other user interface frameworks, JavaFX is single-threaded; but since most modern computers have multi-core CPUs, many JavaFX applications can benefit from introducing multiple threads – as long as it is done correctly, in a manner compatible with JavaFX. This article shows you how.

Thursday, November 22, 2012

Coding Patterns: Promote The Normal Flow

Working as a Java consultant, I have often been involved in discussions on coding style; and quite often, developers disagree on how to order the code blocks of if-else statements. The issue arises from the fact, that in a regular if-else statement with two code blocks A and B like this one
if(condition) {
    … A …
}
else {
    … B …
}
the two blocks of code, A and B, can easily be reversed by negating the condition like this
if(!condition) { // notice the '!'
    … B …
}
else {
    … A …
}
So, which is preferable? if-A-else-B or if-B-else-A? The answer I hear the most is: "Well... that just depends on the if condition." Unfortunately, that is not the correct answer – Far from it.

Sunday, November 4, 2012

JavaFX and the Missing Interfaces

During the development of my company's JavaFX based application framework, I have often been challenged by the extensive use of superclasses rather than interfaces in JavaFX. Here are my thoughts on what could be done to improve JavaFX in this regard.