There is no accurate documentation of your code but your code itself

Posted Leave a commentPosted in quality assurance, refactoring

It’s a common misconception that every program needs documentation. Most people seem to be terribly scared by programs lacking documentation. Whenever I am asked where my documentation is, inevitably this question is followed by the next question: “What happens if you leave the company? Nobody´ll be able to figure out your code!”

That’s nonsense.

How to use Primeface’s poll component to do lazy loading

Posted Leave a commentPosted in JSF

This is a nice little trick a collegue of mine found out. Consider a JSF page that uses a major backing bean. Suppose it takes a long time to initialize this bean (e.g. because huge amount of data have to be loaded from the database). The JSF page is shown when the backing bean has been initialized completely.

You can also use Primefaces remoteCommand to implement a better and simpler possibility to do lazy loading.

Liferay Hooks

Posted Leave a commentPosted in Uncategorized

Liferay has a nice feature to influence the portals behaviour by deployable items. Among other things you can use theese “hooks” to call a java method if the user logs in or logs off again. My particular use case was to show different pages to different user groups.

Hooks are described nicely at Unfortunately this description is a little outdated. For the sake of convenience I jot down the basic steps to write a hook.

Simplify JSF

Posted Leave a commentPosted in simpliying JSF

This is the first part of a multipart series showing you how to make writing JSF page more fun. You will get better results writing less code.

Let’s have a look at a simple, yet typical form consisting of a single input field:

JSF source code

We have to write three lines of code to implement one input field. Looking carefully at the code, you will see the repetitions:

JSF source code with annotations showing the repetitions