Wednesday, October 31, 2007

charades

I don't like Halloween. It's a boring holiday whose resulting ennui is trumped only by Thanksgiving and its multi-day torture of lukewarm turkey, awkward conversations, and Detroit Lions football. That said, I know that a lot of you are still excited for Halloween and want to impress your peers with a clever costume[1], so I feel obligated to share with you what is probably the best Halloween costume idea you have ever heard; I can't remember if I came up with it myself or not, but in the absence of evidence to the contrary, I will take credit for it here. Prepare to be inspired.

A surefire way to be a hit at your next Halloween party is to dress like a Flintstones vitamin. I'm sure you've seen lots of guys dress as Fred Flintstone, but it's always in the official orange and black outfit; it's a pretty popular costume and you can get it at most stores. To be truly innovative, though, you need to take this costume and paint over it so that it's monochromatic[2] while still allowing the pattern to show through. You can then use face paint to make your face, arms, and legs the same color; if you're really committed, you'll get some temporary hair dye so that your hair will match as well. When you're finished, you'll look just like the Fred Flintstone vitamins that you used to have each morning with breakfast. The public will adore you.

Extra Credit: Children of the 70s and 80s will recall that there was no Betty Rubble vitamin in the original Flintstones Vitamin collection (she first appeared in 1996). If you're a woman who wants to get in on this great idea, you could dress as a Betty Rubble vitamin and impress the socks off of all the trivia geeks who ask about your costume.

[1] Unless you're female, in which case you'll probably be dressing as a vampish [noun].

[2] I suggest purple or red.

Labels: ,

Friday, October 26, 2007

foretoken

Bridgid and I went to Pittsburgh a few weekends ago, and on the way home we witnessed a ten-mile traffic jam on the other side of the West Virginia highway. It was painful to watch people sitting in such an awful mess, especially as we encountered those people who had only been in it a few minutes and had no idea what they were in for. Both of us become extremely frustrated in traffic - the feeling of helplessness, combined with the knowledge that four out of five traffic jams are caused by trivial events on the side of the road[1], just fuels the rage minute after minute. I would rather be attacked by flying robot sharks that shoot lasers out of their eyes than sit in traffic that I know is caused by people who are hoping to see a cool accident and have (apparently) never used the Internet before.

The tragedy in West Virginia brought to mind other instances where we had seen horrible traffic jams that continued to grow because the people driving in the opposite direction had no way of warning the oncoming victims; soon we were discussing ideas for a universal signal that drivers could give to people on the other side of the road to let them know that all hope was lost, and what the rules would be for using it. This post will be my first attempt at harnessing the power of the Internet to start a nationwide trend[2].

First, we need to define some vocabulary:

  • highway - A stretch of road on which there is less than one traffic signal per mile and the average speed limit is fifty miles-per-hour or higher.

  • traffic jam - A situation that requires vehicles to move at less than half the speed limit for five miles or more.

  • free-flowing traffic - The normal rate of travel for a particular road at a particular time of day.

  • bicycle turn signal - The act of raising your left arm so that it forms a ninety-degree angle, often used by cyclists who wish to make a turn signal when riding on a major road. Like this.

If you are driving on a highway and you see a traffic jam, the driver should stick his arm out the window and make a bicycle turn signal from the fifth mile of the traffic jam until one mile after you encounter free-flowing traffic. People who see this signal should assume that the traffic jam is truly a nightmare from Hell, the kind of nightmare where you're falling off a cliff, but instead of waking up when you hit bottom, you slam into the ground and break your leg, and then murderous clowns chase you into a cave filled with robot sharks[3]. In other words, it is not going to get any better. They should get off at the next exit, even if it means buying a map to figure out how to get past the traffic jam on other roads; if no exit will become available in the next mile, they should break the law and make a U-turn on the median. Anything to avoid the soul-crushing agony of whatever the people on the other side of the road have seen.

Some may say that the turn signal is sub-optimal, and that may be the case. Bridgid and I spent a long time[4] brainstorming on this, but we're willing to consider other ideas. Another criticism that I'm expecting is that the amount of time one is required to use the signal is too long; frankly, I think it's a small price to pay when you realize that you stand to benefit greatly if others reciprocate in your own time of need. Our experience through West Virginia was kind of extreme (ten miles of traffic through the Appalachians, with limited exits and supporting towns), but at a law-abiding seventy miles-per-hour, I only would have had to keep my hand out the window for five minutes in order to help my fellow citizens.

Now, before you all go out and start using this new signal, I must warn you to be conservative and stick to the rules. If we have people driving down the interstate with their hands out the window every time there's a five-minute backup, people will start to ignore the signal and it won't be useful anymore. This isn't like flashing your headlights to warn others of an upcoming speed trap - overuse of the signal could do more harm than good. The next time you're on a long trip and you see a never-ending train wreck piling up in the opposite direction, wait for the fifth mile, and then open your window and fulfill your duty as an American motorist.

[1] Sixty-five percent of people read this statistic and believed it without even checking my footnote to see if I made it up.

[2] If you're outside of the United States, I apologize, but I don't have any experience with your cross-country traffic, nor have I learned all of your offensive hand gestures. You'll have to start your own trends.

[3] The danger that flying robot sharks pose to humans is only exacerbated by their ability to navigate in the dark.

[4] A solid ten minutes.

Labels: ,

Wednesday, October 17, 2007

grassroots

Zero now has a nice little database setup tool that helps one follow the guidelines described in this article. Steve Ims and I tweaked, updated, and refined the guidelines so that the tool could be reusable without programmers having to add configuration stanzas or additional artifacts to their applications; there's more information about this feature on the Zero forum, but I wanted to add a personal note about how gratifying it is to see this code make it into the Zero code base.

Ninety-nine percent of my programming habits - from how I arrange my file system to how I debug applications - are either slight variations on the habits of others or bordering on OCD. This means that a lot of the effort that I put into optimizing my productivity never benefits anyone other than me. I think this is why I feel that the most satisfying contributions that I can make to a project are the ones that originated from code that I wrote to make my own life easier, not those that are part of a feature plan. Perhaps this is just the ultimate fulfillment of my obsessions - forcing other people into my behavorial patterns - but I'd like to think it's based on the feeling that my improvement really is an improvement; with feature plans, sometimes you get it right and sometimes you don't, and you have to wait a while before you find out which is the case.

Okay, it's probably the obsessions. But it still feels good.

Labels: , ,

dispatch

My latest article: Create a photo album application with Project Zero and REST design principles. Enjoy.

Labels: ,

Wednesday, October 10, 2007

goo

After publishing one of my recent posts, I noticed a Freudian slip in the way I talked about software standards (emphasis added):
I think of security-related code as [being] responsible for authentication, authorization, encryption, and the complex protocols that the industry has created to simplify them.
My initial reaction was to correct this oxymoron, but then I realized that it was a fairly accurate description of many software projects and protocols that I encounter every day. My previous work in WS-Land was a great example of this: things started out simple, but as the specs expanded in order to handle more use cases, it became much harder to provide a simple toolkit for implementing them. Complex problems beget complex protocols, all in the name of simplification.

On the Zero forum there is a discussion about whether or not to include support for the deserialization of JSON data into Java beans. My gut reaction to this - which is based on many years of programming in strongly-typed languages and the belief that context assist is a inalienable right - was that converting JSON objects to beans is a fantastic idea, and that I wouldn't want to be friends with anyone who thought otherwise. Data binding, while complex in many ways, simplifies the even more complex problem of wading through the raw bytes of serialized objects. Right? You have to have principles.

Pat Mueller agrees with this sentiment, comparing a JSON object to a bag of goo, which doesn't sound like something that is easy to debug. If you have any doubts about this, ask a programmer on your team if he thinks his current project could be improved by adding bags to goo to the source - at best you'll get a weird look, and you probably won't be invited to give your opinions on the project anymore. In general, people don't want bags of goo in their source code.

What I could not have predicted was just how much working on Zero has changed my world view, and how much I would waver as I started to think about my experience creating RESTful services with JSON data structures. The more I thought about it, the more I realized how easy it is to get things done with JSON's Java APIs; the JSONObject and JSONArray types are just Maps and Lists, respectively, so if you're unfamiliar with the data flowing in or out of a service, it's easy to learn about it - just dump it to the console! The true nature of any JSON data structure can be determined in one step, without reading any documentation[1]. There is no data binding framework to configure or reflection errors to debug - you get the data in a simple collection of name-value pairs, and that's that. It's made service development a simple affair without the presence of a complex protocol.

But why is it okay to work with bags of goo for my RESTful services while demanding strongly-typed APIs in my other code? I definitely wouldn't want to write JavaScript-style code for all of my projects - it's too frustrating - but I like it for sending packets of data between applications and processing said data in a single module. Once you have to start delegating the data processing to multiple classes or systems, the Map and List usage becomes confusing because the origin of the data is no longer clear to the reader. This is where Pat's bags of goo comment rings true for me - if you're just passing around hash tables from library to library, you've got a debugging nightmare on your hands. For Groovy scripts in Zero, though... it's nice.

The worst part about using a more dynamic, JavaScript-style of coding in Java would be the inevitable move towards something like EMF, which I hate with the hate of a thousand suns. I think that as long as I stick to using simple collections for immediate processing of service I/O and use strongly-typed beans for the rest of my logic and utilities, I can enjoy the magic of JSON without getting lost in some programming black hole.

In conclusion, my thoughts on data binding and type safety aren't as concrete as they once were, and I think that pure JSON objects and other goo-oriented data are great for Zero developers creating RESTful resources. Hopefully Pat and I can still be friends.

[1] You may need docs to find the values of enumerations (if any), but you would have to do that for a bean-based API too.

Labels: , ,

Wednesday, October 3, 2007

peacemaker

I know what you're thinking: Ruby on Zero? That's unpossible!

In this time of red states and blue states, sharp political divisions, and talk radio played at entirely inappropriate volumes, I thought it was best to do something for the world that brought people together. I'm a peacemaker, breaking down barriers one developerWorks article at a time. Check it out: Add Ruby Scripting to Your Project Zero Applications.

Labels: ,