Nook what the cat dragged in!

I must admit, I kinda want a Nook. I was never too keen on the Kindle, but this new offering from B&N appeals to me on a number of levels.

  1. Wi-Fi to download books off my home network, useful since I live just outside AT&T's 3G coverage area
  2. Expandable storage, giving me both unlimited capacity AND the ability to backup my digital purchases
  3. Support for more file formats
  4. Replaceable battery. I always worry about devices, especially expensive ones, that I can't replace the battery in on my own. I would prefer a standard-sized rechargeable battery, but I'll take this.
  5. And, of course, the geek appeal of Android

I'm rarely an impulsive gadget buyer, but if I get through the holidays without receiving one of these then the first after-Christmas sale just might tip the scales for me.

Are you ready for some Futsal?

Sharing is Caring

As I've mentioned before, one of the things I enjoy about being among "The Learned" is sharing technology with friends and family. This afternoon I sat down with the editor of Futsal On-Line to discuss web site technology. His site has been covering futsal, a form of indoor soccer (or football everywhere else in the world) for several years and has attracted a respectable following. I recommended several free Google services for managing his online presence.

Knowledge is Power

Google Analytics provides a lot of useful information about your site's audience. In addition to counting and charting page views (hits), you can also see where your visitors are on the globe using the Map Overlay, find out how visitors are reaching your site, and much more.

Google Webmaster Tools provides information on how Google's webcrawler sees your site, where it ranks based on different search terms, and what sites are linking to yours.

Translating is Hard

... unless a computer does it automatically for you. This Google blog post talks about a translation gadget that you can add to your site to allow users to easily translate your site using Google's free automatic translation service. You can try it out in the sidebar of this very blog.

Money is Not Grown on Trees

I also suggested Google's AdSense for trying to offset the costs of running a website with a little ad revenue. This blog post includes a video by Google's Chief Economist, Hal Varian, on how the AdWords auction works.

A Brief Narcissistic Interlude

I started this blog last year because I had a few things on my mind and thought I'd write about them. I also wanted to try out Google Analytics and figured a blog was a good place to track traffic. Since then I've also worked on my Google Profile, played around with Google Sites and I was even talked into joining Facebook recently.

And what are the results? Well, the blog traffic has been less than impressive. But then, I haven't been the most prolific poster or promoter. However, I have made a name for myself on Google. For the first time today, I found that I dominated the first page of search results for [Isaac Truett]. My Facebook profile comes in at #1, followed by several postings on GWT forums. Lastly, my Google Profile has qualified to be featured in search results.

But this isn't all just self-promotion. I've learned a lot about these free online services and I've enjoyed sharing some of that knowledge with family and friends. I had a conversation recently about how much is available for free that businesses, organizations, and individuals can take advantage of online. The same things I've done to increase my public presence on the internet can be done to promote and enrich your own group or yourself. I'd like to find more ways to share this knowledge, because the more people and organizations create web presences, the easier it gets to find what you're looking for, or what you need, on the internet.

When Peer Reviews Attack

I'm a big fan of peer review in software development. I love sharing ideas, getting feedback on my work, and finding ways to improve my code. But in over 7 years as a developer, I've never seen reviews be done as often as they should. And, sadly, several that I have seen and participated in have gone horribly wrong. The failure usually boils down to poor communication. A bad review meeting, or chain of emails, can degenerate into finger pointing, hurt feelings, and ultimately failure to achieve the goal of the review process: high quality code.

Why review?

Peer review brings many benefits to a software project. It's an opportunity to have another pair (or more) of eyes on a developer's work, trying to catch subtle (or simply careless) mistakes, suggest ways to improve code, or ensure adherence to standards. Peer review is collaborative; the reviewer is taking a stake in the original work and will be backing it with their own seal of approval at the end of the review process. Problems will be caught sooner, standards will be followed consistently, and both reviewer and reviewee will have a chance to learn from the collaboration and perform better in the future.

What could go wrong?

Plenty. For example:

  • Expectations for the process aren't set up front. A developer who doesn't know what to expect from the process may not be prepared to participate properly.
  • Standards aren't communicated in advance. Peer review shouldn't play out like a game of Mao.
  • The reviewer is overzealous. Peer review isn't a time to pursue one's own programming ideaology. That's what the standards committee was for!
  • The reviewee takes it personally. Remember that it isn't about you or your worth as a developer. It's about working together to produce high quality code.

I've seen each of these dramas. They lead to alienation of team members, reduced productivity, and sometimes the abandonment of the entire review process. But I've also seen code reviews that work. Good reviews allow ideas to flow freely and the result is ultimately a better solution. Even if I'm only sitting on the sidelines of a review, I can learn something from the process that makes me a better developer.

What makes a better review process?

  • Document the process. Make sure developers are aware of the review process before they begin any work that will be reviewed. If possible, have a new developer sit in on a review first. Reviewers and reviewees should know how the process will work, what they're expected to bring to the process, and what the expected results are.
  • Document the standards. Make sure you have clear, reasonable, and up-to-date standards documentation available to the reviewee before they begin any work that will be reviewed.
  • Be specific. The reviewer should point out not only which rules were violated, but also where. Give the file name, line number, and a brief description of the violation.
  • Be flexible. The reviewer should ask questions and suggest alternatives, but keep in mind that there's a difference between a violation or bug and an option he or she might prefer (if you can't prove empirically that it's better, then it isn't a blocker). The reviewee should do his or her best to follow standards and document code where necessary, be ready to fix problems that are found, and be open to considering suggestions.

It's a jury of your peers

I think this one point is worth stressing. In the best reviews I've seen done, everyone is treated as an equal. It isn't a senior developer lecturing a junior on proper technique, it's two (or more) developers who may not be of equal experience or skill, but nevertheless regard each other, and the process, with respect.

Really cool frogs

This post is entirely frivolous. But it's short, so please read it anyway.

I found a picture of a "glass frog" (Hyalinobatrachium pellucidum) on BBC News today. It's the 5th image in this slide show. I don't know when, or if, those slideshow URLs expire, but if it does then you can still find some decent pictures with a search on Google (look for one showing the underbelly).

That's just so cool.

GWT for Chrome extensions?

Google I/O 2009 opened today. While I wasn't able to attend this year's event, I have been watching for interesting developments. The first I've seen is this post on the Chromium Blog. Google's plan is for extensions to the Chrome browser to be web pages written in HTML, JavaScript, and CSS. Chrome will provide a JavaScript API for extensions and Google will provide a service for extension hosting, discovery, and automatic updates. How long before we see a GWT wrapper for the Chrome extension API?

GWT, and AppEngine, and Eclipse - oh my!

There's much to be happy about for Java web developers this morning. Google has announced support for Java on AppEngine. Early access is being granted on a FIFO basis, however you can download the SDK now. But wait, there's more! This SDK includes the long-awaited Eclipse plugin for GWT! Read all about it on the GWT blog.

That's made my day.

NullPointerException

Why write about NullPointerExceptions?

NullPointerExceptions are one of the most basic runtime errors encountered in Java programming. Learning how to fix NullPointerExceptions is a vital skill for anyone programming in Java, as any student or amateur Java programmer will encounter these errors eventually. Sadly, even some professional Java programmers are stumped by them. I hope that this article will help programmers understand what NullPointerExceptions are, why they happen, and how to fix them. And for when all else fails, I'll offer a few pointers on asking for assistance with a NullPointerException.

What is a NullPointerException?

A NullPointerException is an unchecked runtime error. As such, NullPointerExceptions do not have to be declared in a method's throws clause. Because they are not checked exceptions, it is easy to forget about them and many programmers will not make any effort to handle or avoid NullPointerExceptions until they start occurring. A NullPointerException may indicate a logical error, improper data validation, incorrect use of an API, or some other programming problem.

Why do NullPointerExceptions happen?

A NullPointerException is caused by an attempt to dereference a pointer that doesn't point to anything; the pointer is null. Here are a couple of common scenarios where NullPointerExceptions can be found:

1.    String myString = null;
2.    System.out.println(myString.length());

Here a variable, myString, is declared and initialized to null on line #1. When line #2 attempts to deference the variable myString in order to print the string's length, a NullPointerException is thrown because myString doesn't point to anything.

1.    System.out.println(aMethodThatReturnsNull().toString());

This second example is a little trickier. No variable was declared, but there is still a pointer: the return value of the method aMethodThatReturnsNull(). That fictitious (and seemingly useless) method will always return null. As we saw in the first example, attempting to dereference a null pointer and call a method on the referenced object (which is null) results in a NullPointerException.

How do you track down a NullPointerException?

To find the source of a NullPointerException, start with the stack trace. In your Java console or log file, you'll see something like this:

Exception in thread "main" java.lang.NullPointerException
	at com.foo.example.NullPointerExample.main(NullPointerExample.java:21)

The stack trace tells you what happened (NullPointerException) and where (line 21 of NullPointerExample.java). Look at that line and see if you can recognize one of the two patterns given above. Ask yourself these questions:

  1. Are you calling a method on a variable that might be null?
  2. Are you calling a method on the return value of another method, where the first method might return null?
  3. Are you absolutely sure the answer to the first two questions was "no?" NullPointerExceptions can happen for other reasons, but these two are by far the most common.

How do you ask for help with a NullPointerException?

First, put some effort into it. Although most developer communities are ready and willing to help with problems relating to the community's subject area, NullPointerExceptions are very often simple programming errors and probably off topic for anything except a Java beginners forum. So before posting and asking for help, determine if the problem is in your own code.

Once you're certain that the exception isn't arising from your code, take a look at the code that is causing the exception (see above). You might be using an API improperly. Third-party libraries may not support null parameters, for example.

If you still need help, be sure to follow these guidelines when posting on a forum or emailing colleagues directly:

  • Be polite. You're asking for other people's time, generally without paying for it.
  • Be thorough.
    • Include the stack trace from the exception.
    • Include any of your code that is relevant to the stack trace.
    • Explain what you've done to troubleshoot and detail your findings.
  • Be patient. People are busy and have their own priorities. It may take hours or days to get a reply from the community, and longer to get a free solution. If you need immediate, devoted attention, you should expect to pay for it. If you want to "bump" your message to get more attention, don't just post "bump" or "can anyone help" -- offer up some additional information to demonstrate that you're taking ownership of the problem and still working on it (nobody wants to do your job for you!). Your new findings may elicit a response. Whining about not getting a response is unlikely to help matters and can alienate the community members who could assist you.

Google I/O 2009

Google has announced Google I/O 2009, Developer Conference. I attended last year's event and I hope to go again this year. There will be sessions on App Engine, Android, Chrome, GWT, and other topics.

At I/O '08 I had the great pleasure of meeting members of the GWT team including Bruce Johnson, Sumit Chandel, and Miguel Mendez, as well as fellow GWT application developers. That was the first time I'd attended a developer conference and I found it completely worth the time and effort (I had to fly across the country to attend).