The birth of Marco Antonio

Today my beautiful wife, Elizabeth, gave birth to our second son, Marco Antonio. He is 8 lbs 7.4 oz and 21 1/2 inches long. It is truly a blessing to have such a great growing family. Adan, our oldest, seems to be liking the idea of having a little brother, but I’m not sure he truly understands what’s going on. But then again, he might know a lot more than I think he does.

It will be great to watch both boys grow up into men. I will try my hardest to instill in my boys integrity, honor, and what truly is the most important in life, family.

Now to get some much needed sleep, since there will be many a long night for the next several months. Especially for Elizabeth, God bless her heart.

Boolean.getBoolean not what you think it is

In Java there is a Boolean object which has a nice static method called getBoolean that takes in a String. It returns a primitive boolean. So one would think that the following would print true.


String foo = “true”;
System.out.println( “Value [" + Boolean.getBoolean( foo ) + "]” ); …

But getBoolean() does not translate a String into a boolean primitive. It gets the boolean value of a SYSTEM PROPERTY.

From the Javadoc:
Returns true if and only if the system property named by the argument exists and is equal to the string “true”.

Eclipse Tip of the Day

As more and more folks here use Eclipse, I get more questions about it. So here are some tips I found useful:

Change Key mappings i.e. F3 for searching

  1. Click on Windows -> Preferences
  2. Open Workbench -> Keys
  3. In the Commands listbox, choose Edit -> Find Next
  4. Select the Text Editor entry in the Assigned key sequences: table
  5. In the dropdown box labled Key sequence choose F3
  6. Click Add
  7. Click OK

Happy searching.

Eclipse

Many folks at work ask me which Java IDE I prefer, I usually answer Eclipse, which is the IDE I’m hoping we migrate to. Personally, I’ve never been an IDE fan. I much prefer Ant scripts, a good editor like Vim, and a compiler such as Jikes.

Enough rambling, Eclipse is really a great IDE. The SWT makes it fast and look like other native applications which is one of my biggest problems with Swing. It’s slow and doesn’t behave like Windows or Linux. Eclipse has a large list of availble plugins

Here are a few of my favorites:

Lomboz J2EE
Omondo UML
VI plugin

There’s also an effort to port the SWT to work with OS/2 and get Eclipse running, check out http://eclipseos2.netlabs.org/.

Brace location

When I was developing in C++ I was always an advocate of placing the brace at the end of the line instead of on a new line.

NewsLetter::NewsLetter( istream& str ) {
    while( str ) {
...

Then I made the switch to Java and decided that the brace should be placed on a new line.

public class Foo
{
...

This was because I thought it was easier to read. But it turns out it was because I was writing methods that were way too long and cumbersome to understand. Now I’m writing smaller methods which work well with the brace at the end of the first line.
Another style I saw which I do think is bizarre is placing the brace on a new line, then placing code directly after it.

public class Foo
{ Foo()
  { System.out.println( "Hello World" );
  }
}

But I believe that the best way to go is let the developer choose their format of choice. If a consistent look is required then use an automated tool to cleanup the code during build time.

Java Interfaces

One of my pet peeves is when an interface is created and implemented yet the code expecting the interface simply casts it to a concrete class. My philosophy is that if my class implements an interface and I pass it into a method which expects an object that implements an interface, that method should not ASSUME it is getting a particular type of object. ARGH!