27 März 2010

NetBeans vs. Eclipse (Again)

Because of some driver problems I had to reinstall Windows 7 on my notebook (Yes, I use Windows!). This took a while and then I was ready to install my IDEs. I use Eclipse an NetBeans in parallel, depending on what the customer uses.

Again I recognized an extreme difference in the installation procedure. Here the steps I had to do:

  1. Download IDE and, hey surprise, GlassFish is bundled as well!
  2. Install it
  3. Run NetBeans
  4. Check out project from SVN. NetBeans asks me to download/install SVN. After a click and a restart NetBeans is ready to use.
  5. Start developing using Maven2, Java EE 6 and GlassFish
  1. Download Eclipse
  2. Download GlassFish
  3. Run Eclipse
  4. Decide if I want to use Subversive or Subclipse. I prefer Subclipse.
  5. Install Subclipse
  6. Install m2eclipse
  7. Install GlassFish integration
  8. Restart IDE
  9. Checkout project from SVN
  10. Start developing using Maven2, Java EE 6 and GlassFish
As you can see, NetBeans brings all you need and it's very easy to install and use. Where as Eclipse doesn't contain any plugins that are used these days in the industry (Maven2, Subversion, etc.)

To do a quick start I recommend NetBeans. And if you want to use Eclipse make a backup after you have installed all the plugins!

17 März 2010

How JavaBean Properties Should Look Like

During a discussion about JavaBean properties in JSF managed beans and entity classes I had an idea for simplify the usage of properties. Because specially in managed beans the getter and setter are annoying and make the code hard to read.

In my opinion the C# way is straight forward:

public class TimePeriod {
    private double hours;

    public double Hours {
        get { return hours; }
        set { hours = value; }

But for a simple case like this the C# way is still to complicated.
So why not use annotations and a new modifier called property. For example

public class TimePeriod {
@Get @Set
    property double hours;

With the annotations one defines if a property is read-write, write-only or read-only. The new keyword "property" defines how to access the property.I like the possibility in C# to use = operator for getting and setting the properties value. So "property" indicates that one can use = to access the value.

And if you don't like the default behavior you could still override the get and set method for the property.

NetBeans toString() Generator Plugin Moved

Due to the ambiguous information of Oracle/Sun concerning Project Kenai I decided to move all my projects from Project Kenai to Google Code.

Please find the NetBeans toString() Generator Plugin there.

03 März 2010

JPA and Bean Validation

Nice article from Antonio Goncalves about integration Bean Validation and JPA:

In JPA 2.0 the integration is defined but It describes an easy integration with JPA 1.0 as well.