Sunday, May 27, 2007

The domain

Note: Blogger is probably gonna mess up the styles in this post pretty bad, so forgive me if I re-post a couple o' times. View the original post if the feed item is garbled.

I've figured I need to get rolling on the example/reference case for the Action Domain Object-talk.

After some long and hard pondering I drifted away from the insurance domain and into something far more web 2'ish: an online community site.

I'm gonna call it The Universe. It's pretty simple, facebook'ish application that includes Worlds, Groups, Rooms and People.



Some cases:

  • The Universe can crud (save, browse and delete) Worlds
  • A World can crud Groups , Rooms and People
  • A Group/Room can add/remove People (members)
  • (or a Person can join/part Rooms and Groups)
  • A Person can send messages to People or Rooms
  • A Room is like a chat-room, as opposed to Group which is a more permanent organization of People
These 6 different entities are my Action Domain Objects.

It does have some complexing features, like a bunch of many-to-many relations, and plenty of alternative ways to implement the domain model, i.e. which entity is responsible for sending messages, manage People, etc.

Now, this wouldn't be any fun to implement without some restricting rules making it hard for me:

No Services and DAOs, only (a few) aspects/interceptors.

It will be implemented in Java.

Only one file/class per entity.

Operations should be RESTable.

They should be executable from a console application.

No XML (!).


So, then I started thinking about some URLs. Thinking URLs are a great way of getting an elegant web application. You get re-usable action chunks (cause you start thinking of atomial simple operations) and pretty URLs.

Let's trigger some operations:

Behold, The Universe:
/universe/browse
Create a World in the Universe:
/universe/worlds/create?name=earth
Next, create a Group in The newly created World:
/universe/worlds/earth/groups/create?name=developers
Create a person:
/universe/worlds/earth/people/create?name=ferris

Oh, I just discovered I need a couple of other entities to represent relations between People, Groups and Rooms. I'll use memberships for Groups and visits for Rooms.

Add me to the developer group (I'll skip the /universe/worlds/earth/ from this point):
.../memberships/create?member=ferris&group=developers
Later on, I log in:
.../members/ferris/login?password=postit
And join the chat-room "hackers":
.../visits/create?visitor=ferris&room=hackers
Send a message to the hackers-room, oh copy to John by the way:
.../messages/create?subject=Hey&sender=ferris&receipients=hackers;john

Right, think the idea is starting to come through. Now it's getting a bit late so I'll think I'll have to leave it like that. These URLs are very much subject to change, and if anyone can see any pitfalls I'm running in to, please comment.

Next week I'm gonna figure out whether I'm gonna make this happen with Grails or Struts2, or some other technology.


The following have been the inspirations to this post:

Sunday, May 20, 2007

The academical approach

Oops, seems I to published this post prematurely by hitting some Blogger keyboard shortcut.

I've been sitting for some minutes trying to figure out how to approach the JavaZone talk mentioned in my previous blog-post.

Note that I have already submitted an abstract to the comittee, and that I won't publish the abstract here in the blog. Now of course the abstract is pretty detailed on what the talk is going to be about, but I've still got some elbow room on how to "implement" the talk.

I will use this blog as a tool to get my aim right on how to present the talk, what examples to include, what the slides should look like, and how to make it most straightforward and understandable for the audience.

Now in lack of having done any presentations at a larger conference before, I'm gonna dig into what I learned at the University, which wasn't very much, but they did teach me how to write a research paper, a skill which I will adapt into creating my talk:

The one rule over all rules in research: Crystallize your research question

Your research question is what you are trying to answer with your work, be it a thesis or a presentation. If you can't narrow down your research question to a single sentence, then you probably aren't quite sure what you are talking about. If you're unable to squeeze it into one sentence, squeeze it into two sentences and split them in two different talks.

Unfortunately, I started off my abstract with a pretty abstract research question:

"How can we speed up application development?"

(I was tempted to specifying web application since I'm a web-app dude, but thought it would be more valuable if the principle could be drawn into all kind of applications. Still might go reversal on that point though.)

Now the research question is interconnected with the following questions:
  • Motivation: What's our Problem (as an industry)?
  • Conclusion: How are we going to solve it?
These two questions try to figure out what I will be contributing to the field of knowledge. This is basically the points that will drag audience into my talk. My answers are as follows:

Q: What's the problem?
A: We spend too much time developing applications.

Digression: Time can be divided into three parts: (1) understanding domain and technology, (2) bootstrapping the project and (3) implementing the stuff. My main focus is on problem number (3), although it is mildly tempting to dig into number (2) as well (using Maven archetypes and/or similar tools to achieve RoR-like scaffolding), but that's a bit off my chart.

Q: How will we spend less time developing applications?
A: By writing less code and doing less configuration.

Now the audience should be asking: How?

The answer is: By using Action Domain Objects (ADOs). Hmpf, now I realize I came up with my own 3LA which is even the same name as the persistence framework in .NET, but I'm hoping I'll get away with it.

Note: I just googled the term and it seems it a guy named Scott on the Struts user mailing list already coined the term like 2 months ago. I'm hoping I'll get away with this too :P

So what are these ADOs and how am I going to make them work? Well, I'll get back to that next week.

Saturday, May 19, 2007

The Blog that died and came back to life

A good month since my previous post. Apologies to those who've patiently been waiting for my weekly post. I've been busy sneaking agile into a project, running, cycling, doing two projects simultaneously, doing a Maven workshop (was going to write about that, but was too beat at the time), maintaining a wiki, writing an abstract for JavaZone, and having a real life at the same time.

In spite of having many things to do, things are going really great. The customer's project is really exciting, and I'm able to use some really modern, high quality frameworks, receiving experiences that I might be sharing at JavaZone this year.

Anyhow, this post announces a blog-ressurection. I'm getting back into the weekly cycle, at least till the summer, starting tomorrow. The red thread throughout the posts will be pointing towards my proposed JavaZone talk (atleast until it gets rejected :P ).

I'm gonna give an easy tease on what it's gonna be about: We've had Ruby on Railers bouncing around creating killer CRUD apps for some time now, and it is somewhat perplexing to me that us Java lads have not been able to come up with something equally easy, just for the heck of it. Well, point is that we have now. Modern frameworks (like Struts2) allow us to hammer in conventions (as in, before configuration) that can have a major simplifying impact on applications.

The above paragraph is one way of approaching the presentation, although I still haven't settled on the perspective I should take. Another more theoretical approach would be "A discussion of simplifying application development through the use of Action Domain Objects", but more on that tomorrow.