Friday, October 20, 2006

Scantily Clad Objects

Recently, I've been pondering Naked Objects. Relax, it sounds a lot more exotic (and inappropriate) than it is. Naked Objects is a programming philosophy.

Once upon a time, we programmers used to hand generate our persistence layer. Then, someone had a brilliant idea - instead of maintaining domain models and a persistence layer, we should simply generate one from the other. That saves half our work. And that's what projects like hibernate are all about. You provide a well defined set of objects, and bam!, they create a persistence layer from that.

Naked Objects takes this notion in another direction. It suggests that rather than trying to keep your UI in sync with your domain model, you should simply generate the UI from a well defined set of models. For example, instead of having to create a User object and a RegistrationAction, why can't you simply have a generic method for creating User's and simply have that stand in the place of registration?

All these concepts are well explained in this set of articles about Naked Objects. The article even provides a concrete set of examples by comparing an auto generated app with that of an old fashion, hand crafted model.

I really like the Naked Objects approach because it's an attempt to have programmers write less code. That's a really good thing. The main challenge I see with Naked Objects is that the apps it creates are fairly standardized - they have to be, because if they were customized, then you'd be essentially creating the GUI that we are trying to so hard to avoid. Unfortunately, in the world of UIs, being able to have custom behavior is critical.

This means that at the end of the day, I don't think I'd feel comfortable delivering a Naked Objects app to an outside customer. I can just imagine their questions as to why the app looks and feels the way it does, and perhaps more importantly, why the programmers aren't excited about customizing it.

But, with that said, I still see a huge opportunity for the Naked Objects paradigm. That opportunity is in the creation of internal tools to work with a custom application. For example, you might build a fancy schmancy photo site using a typical four layer architecture, and then use Naked Objects to create the management tools. If you can produce the management tools quickly and with the required functionality, then you can be excused for not having the slickest of UIs.

So, what I'm suggesting we need are Scantily Clad Objects - objects that are nearly naked, and play well with their fully clothed brethren.

Hmmm, perhaps I pushed that analogy a little too far?

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails