Categories
Archives
Category Archives: Code
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?
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.
Measuring our awesomeness iteration by iteration
Like a lot of startups (and big companies!) we use iterative development: we break up our work into "stories" describing features and implement as many as we can in one month. We then repeat that until we conquer the world. But, if we can do more, or work more efficiently with each iteration, our goal of world domination will approach that much quicker :)
The easiest way to do that is to look at the bugs our QA staff find in the product updates. Although we have a lot of automated tests, we still need some eyes on the applications to check for things like text overruns of our printed reports, or JavaScript weirdness in some less-than-well-behaved) browsers.
When adding more threads makes it all slower