Jerome Louvel <contact <at> noelios.com> writes: > > > Vincent, > > > Sorry if I wasn't clear. Let me try again. > > > > You display 2 resources on one page: > > > > 1) your profile. By default, the Profile section display your > > name, but it include a More link that let's you display your > > name, your email, the number of posts you've made, etc. > > > > 2) the forum > > When you click on a forum thread, the Forum resource must pull the > > Profile resource out of the DB in order to redisplay the page. > > > > When you click on the More link (in the Profile section), the > > Profile resource must pull out the Forum info out of the DB to > > be able to retrieve the page. > > > > So, you're introducing a dependency between these two resources. > > > > If you later decide to display the weather report on that > > page, both the > > Profile and Forum resources will have to be made aware of the > > WeatherReport > > resource in order to display the page. And so on. > > > > If you say that the Profile and WeatherReport resources are > > part of the > > representation of the Forum resource, you must also admit that the > > Forum is part of the Profile's (or WeatherReport's) representation. > > > > I think this creates an unmanageable graph. > > I wouldn't say that a resource is part of a representation, rather that a > representation can be a composite representation, agregating several > representations into a larger one. > > In a typical object-oriented model, you will frequently have such > cross-references in your domain model, there is nothing wrong about that.
What is wrong is to violate the abstraction layer your created with your OO model. A car has a rear mirror and four wheels (among other things), but the wheels do not need to reference the mirror. We started this discussion by saying that is a page displays resource A and resource B, resource B is part of the 'contextual information' of resource A, and -therefore- A should reference B in order to create a reference of itself. Now, the agreement seems to be that the resource is the page, and we might or might not model A and B as resources, depending on whether we need to access them individually. > Nothing forces your to model everything as resources, you could rely on a > set of EJB Entities or on POJOs persisted in db4o for examples. They would > handle this cross-references naturally. Even if you model everything as > resources, you can also model hyperlinks between all resources. Sorry, I > don't see what is unmanageable here... What is unmanageable is if you create cross-reference between all resources on a page. When you add the resource, you have to modifies the other ones so that they reference this one too. Of course, is we're modeling the page (the container) as a resource, the complexity no longer exists. -vincent. -vincent.

