By Peter Bell

Naked Objects - A Quick Review

At the Code Generation conference last weekend, I got a chance to play with Naked Objects. It is actually quite cool . . .

Firstly, take everything I say with a grain of salt. I was only able to attend about 45 minutes of the full morning lab session, so I am sure there are lots of things I missed, but I wanted to provide a quick review and some initial thoughts.

Firstly, you should try out Naked Objects for yourself. It is an Eclipse plug-in and only takes a few minutes to download so there is really no excuse for not just having a go.

One thing that was immediately interesting was that while Naked Objects is sometimes positioned as a "pure OO" approach, for every object you create it creates both an object and an object manager, so it uses the "service layer" approach that is frequently found in Java (and ColdFusion) applications. Check out under src/main/java/com/%projectname% and you'll see a domain directory and a services directory containing (for example) Customer.java and CustomerRepository.java respectively for a Customer object. Personally I like this. I like the separation of concerns between interacting with an object and interacting with the the class of objects - I see User.save() and User.getFirstName() as fundamentally different concerns from UserService.getByFilter("LastName Like 'B%'") or UserService.deleteAll() and a useful way to break out methods, but it was interesting to me to see that the Naked Objects guys also used this approach - it wasn't the impression I'd got when I'd heard their work mentioned in the past.

As for the system itself it is a very simple but very elegant approach to interacting with objects. Basically it auto gens a CRUD interface for interacting with objects and walking through your business domain by following the relationships expressed between the objects. Their position is that if you find anything you can't do through their interface easily, it is indicative of a weakness in your domain model and suggests that you might want to review the way you've modeled your domain! I am not sure if that is true in every case, but I'm willing to believe that by pretending it was true for a while your object modeling skills would very likely improve quite substantially.

I am not sure how rich or flexible Naked Objects apps would be (mainly because I didn't stay long enough to find out!). I do think it is an interesting approach and if the UI for building object models was sufficiently easy at the very least it'd be a great way to prototype an object model or to get mor comfortable with the whole idea of object modeling if you didn't have an alternate tool available.

Anyone out there played more with the tools? Any input appreciated!

Comments
"Their position is that if you find anything you can't do through their interface easily, it is indicative of a weakness in your domain model and suggests that you might want to review the way you've modeled your domain!"

On one hand, that seems awesomely useful for us. On the other, it seems quite pompous. =)
# Posted By Sam | 5/27/07 10:28 AM
When they said it, it sounded both :->

I'm not sure that they are *right* (I have a feeling they are definitively wrong, but I don't have nearly enough information to decide). However, by pretending they are right I think it'll help me to get better at object modeling, so in private for a while I'm gonna pretend as if they are Right and I'll see where it takes me!
# Posted By Peter Bell | 5/27/07 2:02 PM
just followed the command line interface demo - that is very nice. i wonder if there is a lot of pre-programming that needs to happen to enable that.
# Posted By Ariel | 5/28/07 5:27 PM
I went through a demo, installing the eclipse plug-in and creating a sample project and it went extremely quickly and easily - no programming required at all to get a basic system running. As with any system the question is how steep the customization curve is for the problems you want to solve.
# Posted By Peter Bell | 5/28/07 6:20 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.