Monday, January 28, 2013

How to become a better programmer?

By three methods we may learn wisdom:
First, by reflection, which is noblest;
Second, by imitation, which is easiest;
and third by experience, which is the bitterest.
- Confucius
These words are on my wall to remind me that there are easier ways of learning and in this post, I want to look at it from a programming perspective.

Sunday, January 20, 2013

Java Web Services – bottom-top-down approach

There are two approaches to developing web services: bottom-up and top-down. In the bottom-up approach, annotated Java classes are created first, and the WSDL is generated from these classes using wsgen tool.
Bottom-up approach.

In the top-down approach, the WSDL is created first, and the Java artifacts are generated using wsimport tool.
Top-down approach.

Sunday, January 13, 2013

JSF 2.0 Maven Archetype

Whenever I need to create a new web application in Java, I use the barebone web application Maven archetype that comes with NetBeans. Then, I proceed to add dependencies to libraries and frameworks that the application requires, followed by configuration files for logging and such. I test the setup by creating a "Hello world!" like structure and deploying it to an application server.

Although most of the time this process takes only a couple of minutes, sometimes I forget how to connect different bits and end up reading documentation for half an hour. To avoid wasting time on things I've done many times, I created a Maven archetype with the following setup: JSF 2.0, CDI, PrimeFaces, SLF4J and Logback. The archetype is deploy-ready, containing "Hello world!" examples of the essentials, and can be pulled from GitHub.