Freitag, April 30, 2004

New version of JFreeProfilingCenter

I released a new version of JFreeProfilingCenter at Source-Forge: a tool for performance and load tests of Java programs . I corrected some minor bugs in the UI and did some refactorings to make the code more simple. A very short overview documentation is now available also.

Post bewerten

Eclipse Shortcuts and Key Bindings

To be really fast with an IDE developers need to be able to use the common IDE functions without the mouse. The functions used most often must be accessible with the keyboard only. Jesper Kamstrup Linnet has created a list of the Eclipse default key bindings. The default key bindings can be configured in Windows->Preferences->Workbench->Keys.

Post bewerten

Mittwoch, April 21, 2004

Large Refactorings at Java Forum Stuttgart

I will talk together with Martin Lippert about Large Refactorings at the Java Forum Stuttgart at 1st of july.


Post bewerten

JUnit speaks

Sebastian Sanitz developed an Eclipse plugin which gives JUnit a voice - e.g. the voice of Homer Simpson. The plugin can be downloaded here.
The plugin needs Eclipse 3.0M8 and JDK 1.4.2.

Post bewerten

Do You Speak Java?

Here is a code snippet I found somewhere. Can you figure out what it does? Try code reading first and if that doesn't work, write a unit test. Is there a way to refactor the code to be more readable without loosing performance?

public int doSomething ( final int v[] ) {
int i = 0, j = v.length - 1;
for ( ; !( v[i] >= v[j--] && i++ == ++j ); );
return v[j];
}

Post bewerten

Sonntag, April 18, 2004

Article Directory about Agile Methods

The Agile Alliance provides access to a lot of good articles about agile methods: http://www.agilealliance.org/articles/index

Post bewerten

Samstag, April 17, 2004

MockEJB

Projects using EJB have a common problem: EJBs are necessary for some reason (e.g. scalability) but using EJBs does harm the development process and the flexibility of the application:

  • The turn-around times (edit-compile-deploy-execute) are much longer with an application server than within a stand alone rich client application.
  • If unit tests fail, there are two possible reasons: The code is broken or the application server is not available. It can cost some efforts to figure out what the reason really was.
  • Some application servers consume a lot of memory and are therefore not usable on developer PCs. Then parallel tests of developers may influence each other in an unintended way.
  • Sometimes there is the requirement that the same application must be runnable with and without an application server. That's especially true for off-the-shelf products.

These problems are solvable through architecture. It is possible to introduce abstractions that allow to execute the application with and without an application server. On the downside these abstractions introduce a lot of complexity which often irritate developers.

With MockEJB there is the alternative to solve the mentioned problems with technology. MockEJB provides a local container for session beans (entity beans are not supported yet). That enables the application to simply use EJBs without further abstractions while being executable without an application server.



http://mockejb.sourceforge.net


Post bewerten

Freitag, April 09, 2004

General Level Exception Handling Considered Harmful

Exception handling is somewhat awesome for developers. Therefore some projects come to a point where they catch exceptions at a general level. A short article with some demo code illustrates the risks of catching exceptions at a general level (catching Exception in Java).
I recommend following the "Crash Early" tip described in The Pragmatic Programmer (p. 120).

Post bewerten

Names in source code are important

Nearly everybody would agree that giving communicating names to packages, classes, methods and fields is important. But when non-communicating names are in place developers often argue that naming is not that much important. The pragmatic programmers Andrew Hunt and David Thomas have a strong argument for the importance of naming on their web site (stroop effect).


Post bewerten

Mittwoch, April 07, 2004

Online Pattern Catalogs

Some useful online catalogs of patterns, refactorings etc.:

Post bewerten

Freitag, April 02, 2004

SWT vs. Swing: API

Today two major and incompatible UI libraries are available for Java developers: SUN's Swing and IBM's SWT (which is used for the Eclipse platform). Often it is claimed that SWT is the faster and more stable solution. Since in our projects Swing was fast and stable enough a point of major interest was the API: What is easier and more flexible to program. I did a little experiment based on the very good SWT tutorial "Using the Eclipse GUI outside the Eclipse Workbench, Part 1: Using JFace and SWT in stand-alone mode" from Adrian Van Emmenis. I took the SWT file explorer consisting mainly of a tree and a table from the tutorial and programmed an equivalent Swing file explorer. The code can be downloaded for the SWT-File-Explorer and the Swing-File-Explorer.
The main differences between the two explorers:
  • The Swing explorer needs with 249 LOC about 30% more lines of code than the SWT explorer with 192 LOC.
  • Setting the properties of SWT widgets is follows the C style with expressions like SWT.HORIZONTAL SWT.NULL. Since the properties are simply integers there is a (small) lack of type safety.
One (subjective) word about performance: When using the two explorers I can hardly notice any difference. Only when directories contain very many files the SWT explorer seems to be a bit faster.

Post bewerten

Donnerstag, April 01, 2004

JUnit vs. Fitnesse

JUnit is for unit testing, Fitnesse for acceptance and functional testing. But in projects we have detected that sometimes JUnit and Fitnesse tests overlap. Sometimes Fitnesse tests are smaller and easier to comprehend than JUnit tests - even for single classes.
I did some very simple experiments to get a better feeling when to use JUnit and when to use Fitnesse tests. The sample code can be downloaded and the results of the experiments are documented in a small article.

Post bewerten