I've endeavoured to rely on NetBeans' auto-formatting feature before now, but I've never been able to configure it quite to my tastes. In particular I had struggled to get rules for braces and line wrapping setup how I wanted for Java, with them almost always on a new line. I'm not sure whether I had simply failed to find the right options or if they're new in 6.5.1 or another recent release.

It's perfect for cleaning up code that you're copying and pasting from the web, taking the labour out of it. All I need now in NetBeans is a less tedious way of generating getters and setters that requires less mouse clicks, remembers your last preferences (put at end of file, no comments) and can have m_ prefix on the vars but not the accessor method names.

That said, better still would be for Java to grow up a bit and gain a better way to do boiler plate accessors. Which is better:

Java:

public int getFoo()
{
  return m_foo;
}

public void setFoo(value)
{
  m_foo = value;
}

public String getBar()
{
  return m_bar;
}

public void setBar(value)
{
  m_bar = value;
}

Ruby:

attr_accessor :foo, :bar

Leave a Reply

Your email address will not be published. Required fields are marked *