Categories
Archives
Category Archives: Best Practice
When is a null not a null?
tl/dr: Don't have a non-null object's .toString() display "null". It's confusing and not helpful when looking at object states in IDE debuggers.
I recently converted the attribute of our Person POJO that stored a user's email address from a java.lang.String to a javax.mail.InternetAddress. Call it not enough testing or lack of imagination, but I introduced a Null Pointer Exception in a back-office web flow where a new user is created for our customer service application. When a new CSR account is created and the email address is left blank, an NPE gets thrown up. Embarrassing, but easy to fix, right?
Move meetings to move developers
Here's the scenario:
You cruise in to the office at 8:45, get your coffee, check the reddits, and ignore that email from your parents asking if their computer picked up a virus because McAfee won't stop popping up a tooltray icon helpfully informing them that they're totally vulnerable. Right around 9:15, you get motivated to tackle that 2 point user story for the current iteration.
You head over to the wiki, check out the specs for the requirement, find out what the Trac ticket number is and see if there are any comments with last minute advice or dependencies. None? Good. . . let's get started!
New Developer Law
NEW LAW FOR DEVELOPERS:
If you throw an exception about some connection being refused, you'd better damn well put what connection you were attempting to make in the exception message.
What inspired this law? Thanks for asking.
Subversion Branching “Good” Practice
I am relatively new to Subversion — well, two years into using it now, but this is the first project I have used it on. Subversion, like any tool, has its quirks and works best when you really know how to use it. When I started, I treated the "trunk/branches/tags" directory structure exactly like a directory structure. It took me a little playing around until I stumbled on what I would call a best practice. When I checkout a new project, I do it like so:
svn co http://domain.com/svnroot/project/trunk project
That way, when I go to the project directory, I do not have to then go into the trunk directory to get to my files.
Tie Tuesday – more fun that it sounds