Blogbody Rotating Header Image

December, 2003:

WebWork Tip #1 – Handling null properties

Almost a month ago I promised I’d start to document on my blog a tip per day about WebWork. I feel like a sleezy bastard for having failed to such a thing, but I’m finally making up for it. Disclaimer: this won’t be completely daily, only because I’ll be out of town for New Years, but once I get back it should be just about every day. Hopefully someone can roll this in to a decent set of documents (*hint*hint*)

OK, so today’s tip is:

Handling null properties

Suppose you have an object, User, that you want to populate based on various form fields entered from the web. The most common practice is to create a UserFormBean (Struts) or a bunch of String properties in your action (WebWork) to set these values. Recently Matt Raible stirred up a bit of a discussion about using your domain objects (User) as the immediate input for your data.

Not letting this turn in to another one of those discussions, a common desire when writing applications this way is to make form input fields named things like “user.name” and “user.password”. By doing this, a call to getUser().setName() is made, and your domain object is automatically populated, letting you no longer have to write the code to go from FormBean->DO yourself.

However, what if you have a more complex object? Suppose you want to do “user.shippingAddress.city”. A call to getUser().getShippingAddress().setCity() would be made. Normally this will only work if getShippingAddress() returns a non-null object, meaning that your domain objects must now provide default instances for all their various properties. This just won’t do!

So, thanks to my constant perstering of Drew Davidson (Ognl guru), a NullHandler was added to Ognl. This now allows for you to not have to create default properties in effort to avoid the “null problem” described above. Rather, WebWork is now configured to automatically detect a null reference and then create a new instance (only zero-arg constructors need apply) for you. The end result is that your domain objects remain clean and your webapps can still remain blissfully simple.

A word of caution: there is a small bit of overhead here, of course, so don’t depend on it all the time. Also, dealing with lists becomes a bit more complex. Imagine a property “user.address0.city” — in order for the List property “address” to be properly returning an empty Address object when get(0) is called, more information is needed than is known by just looking at the property and the domain object. This will be addressed in the final version of 2.0, maybe in the form of providing a hidden form field such as “type:user.address:com.acme.Address” (huge security problem here) or in the form of another property file (not another config item). Any suggestions would be very welcome.

And there you have it folks. Tip #1 — please feel free to request tip topics, pimp alternative technologies (especially ones that are conceptually different, like Tapestry), or explain to me why Fresno Taco Bells don’t serve the cheesy gordita crunch.

Gay Hobbits and Taco Bell

Some of the top search requests that lead to my website are:

  • anyone but bush
  • stupid things republicans say
  • stupid things democrats do
  • struts sucks
  • friendster slow
  • golf in the 70s
  • gay hobbits

Wait… GAY HOBBITS? OK, so some of the search terms are a bit odd, but gay hobbits was by far the wackiest one. Then I remembered why a search gay hobbits was causing my web server to show up. It’s pretty amazing to see how such random topics such as Clay Aiken or gay hobbits can perk the interest of totally random people. I think I need to start posting about totally random events to see what other kinds of obscure terms I might.

One particular topic I’d really like to discuss: what happened to the cheesy gordita crunch at Taco Bell in Fresno, CA? They seriously just don’t serve in the entire Fresno country! And don’t get me started on Carl’s Jr’s sourdough ranch bacon cheeseburger being discountinued…

In America

So last night I went and saw In America. I was a bit worried at first, because the opening scene involved the super-played-out scene where immigrants come in to New York for the first time waving and pointing at all the huge neon signs and all the various sights. Cheeeeese.

But then the movie changed, and that cheesiness was contrasted with the family moving in to a crappy apartment full of junkies. I won’t give away anymore of the movie, but I must say it was one of the best I’ve seen in a long time (though, I do admit I don’t get out to too many movies these days).

The most interesting parts to note are the sense of fragility that the film made me feel. At any given point in the film I felt as if this delicate family could be ripped apart any second. At first I thought it was just my mind getting a bit morbid, but my brother and my mom both felt the same way. Although we couldn’t pinpoint what exactly it was that made us feel this way, it was clearly something that the director meant to instill. Truly amazing.

Also amazing were the performances of both girls, but especially the younger one, Emma. This little girl was absolutely perfect.

I didn’t know anything about this movie when I got in to the theater (I like it better that way usually), but I was surprised to see that the film credits were to Jim Sheridan and his daughters Naomi and Kirsten… dedicated to Frankie Sheridan. I’m not sure how much of the story was a true story and how much was made up, but it was really neat to know that someone actually experienced at least some of what would otherwise just be a heartwarming story.

My Mom

Today I got some mail from my mom. Opening the envelope, I discovered two newspaper clippings: one that detailed how more kids than ever are being injured while skiing and snowboarding (I’m planning to go skiing a lot this season), and the other discussing how 22 people pedestrians were killed in San Francisco this year, as opposed to only 18 last year. The article points out that a higher percentage of those killed were at fault this year.

Great. My mom also likes to send me articles about people my age dying of skin cancer, or of kids murdering their parents. Uh huh… I know this can’t be normal, right? And people wonder why I talk about how I don’t expect to live past age 30…

Jon Udell’s Dilemma

So Jon Udell has a dilemma: when using LinkedIn he was asked to define his relationship with someone using a predefined list of options. Of course, none of those options fit his needs and he finds it frustrating that LinkedIn is trying to box in his unique relationships.

Lately I’ve been thinking about my social network less about a graph of connected dots with a single dot (me!) in the middle of it all, but rather a cluster of dots in the middle of the network, where the cluster are various forms of “me”, depending on how I present myself to the person I have a relationship with.

What I mean by that is that the way I act towards my mother is different than that way I act towards my roommate, which is different from the way I act towards my boss. Not only is measuring the “strength” of that relationship important (Spoke does this and I believe LinkedIn has plans to do this as well), but I believe that in non-virtual social circles the people at each end of the relationship are unique as well. There is only one “Patrick-talking-to-his-brother”, just as there is only one “Chris-talking-to-his-boss”. These slants on the individual make the social network much more complex.

In the real world we manage this daily without even thinking about it. I don’t swear in front of my grandma, and so the person she knows is slightly different than others know me as. That unique perspective is important in our daily lives and is very subtle and most likely impossible to ever measure. I don’t think that means that social networks are doomed to fail (duh, I wouldn’t work where I do if that were the case), but I do think this subtlety adds an extra level of complexity to the task of mapping out someone’s social network.

Jon writes that his relationship could have been better represented in the form of a Google query URL. In the future I think more software systems will begin to combine data from all over the place to better understand the unique perspective of each relationship. While not totally perfect, it might provide a good approximation of the billions of neurons that fire off in our heads when we decide on whether to claim, “That was a good fucking movie” or “That movie was really neat”.

FeedDemon RSS Aggregator

Today I discovered FeedDemon, which went gold today. Before FeedDemon, which I fell in love with after just seeing the screenshots, I was using SharpReader. The funny thing is that it took me a second before I realized where I’d heard the name “Nick Bradbury” before.

It turns out Mr. Bradbury is the guy who created HomeSite (since purchased by Allaire, which was then purchased by Macromedia). Back when I was not a software developer, but more along the line of a website designed (at one time I actually had creativity that still flowed through my veins), I was fiercely in love with my beloved HomeSite 1.0.

I continued to use HomeSite until around the the 4.0 line, at that point I a) stopped writing web pages, and b) stopped enjoying HomeSite (I’m sure Allaire/Macromedia destroyed it, not Nick). HomeSite was the first IDE I used that actually did auto-competition — and this was back in 1997 (maybe even 1996? I can’t recall anymore).

Even today, my favorite IDE for code is IntelliJ IDEA, which has far-and-away the best code competition of any development suite. Clearly Nick was ahead of his time, and FeedDemon just proves once again he’s totally in touch with how to build a functional application combined with an amazing user interface.

Rock on Nick!

Disclaimer: my memories of the years and/or the versions I used may be totally off base. All I know is it has been “eons” since I used HomeSite.

My brother’s blog

My brother, Chris, now has his very own blog. I wanted to share that with the world. I also wanted to share the image of the clay chef with the toast. And lastly, I wanted to make a point of that it is now in writing that I am “infinitely smarter” than my brother, as well as you. Deal with it and shut up.

Dodgeball 3.0: why I’ll upgrade my phone

Just found out about Dodgeball 3.0 from Many2Many. This is the reason why I will upgrade my phone and add text messaging to it. I’ve never really been impressed with all the fancy features on my phone (hell, it hardly works half the time anyway), but this is truly awesome.

I just heard from Dennis Crow, who is the creator of Dodgeball, and he informs me that it should be available in San Francisco in “early January”. I can’t wait.

This reminds me of ActiveCampus at UCSD. Through some funding by HP, my professor Bill Griswold was able to get hundreds of PDAs in to the hands of incoming freshman. Then using 802.11b cards and triangulation techniques, he could provide everyone a map of where their friends were on campus.

In a class I took with professor Griswold, Ubiquitous Computing, my team created a messaging system that was designed to route messages based on predefined rules. The idea behind it was that when linked up to ActiveCampus, rules could be created like “if I

the internet always endangered privacy

Another one I found through Danah… connected selves: Buying and Selling the Little Black Book.

Esther was one of the VCs at a recent “under the radar” event — basically a “social software meets WWF” face-off between LinkedIn, Spoke, VisiblePath, and ZeroDegrees. At the time she seemed really concerned with two things: protecting data and avoiding the situation where you have to reject a referral (the you-are-not-my-friend rejection that no one wants to do on Friendster).

Both are a form of privacy. Recently at Spoke we developed a system that spiders the web for information about people to further enrich the social network (especially around searching). Now if someone searches for “OpenSymphony” I show up — even though no person in the network states that I am associated with OpenSymphony.

It’s not that any of these social software companies are exposing more data than existed before (in some cases they are), but the bigger fear is that they are lowering the ease of access to data that was always there.

Google did this a couple years ago. Before Google, who would have been able to find out that in 1996 I used Fractal Painter (?!?). It’s not that Google is invading my privacy — it has just lowered the access to already public information.

In the future companies like Spoke might be able to use information found all over the web — not just the raw who-knows-who data — to build very rich graphs. Like all information, if not properly checked, it could lead to the perception of serious privacy problems.

I say perception because nothing new is being exposed. In 1997 someone could have found that newsgroup post of mine if he or she tried hard enough. Likewise, if someone connects the dots they can figure out pretty much my entire life history via various public newsgroups, mailing lists, blog comments, blog posts, and websites.

Is it scary that in the future all the information that a private investigator might have gathered can now be accessed with a mouse click? Yes. Does it mean that we should all be careful about what we let leak on to the internet? Yes. Does it mean that social networking companies (or Google for that matter) are evil? No. Does it mean they should take privacy seriously and do everything they can to protect the consumer? Of course. Should that be their duty (by law)? That’s yet to be determined.

the uselessness of friendster

So Danah Boyd is talking about how useless Friendster is (she’s mentioned it a few times in the last few days). IM, phone calls, and someday, using location-aware devices like ActiveCampus@UCSD (my alma mater), in-person interactions. Oh well, I suppose we better walk before we start running.

Update: my grammar was horrendous — had to fix. Apparently my bad review wasn’t so off target after all :) MT seriously needs a good applet-based editor to place red squiggles under my words while I spew my garbage.