On 30 Aug 2012, at 03:13, Chris Geer wrote:

> I'm working on refactoring the widget tree as part of the model-split
> Matt's sent a few notes on. After spending some time in the code I would
> like to propose that we make the object model more one-way. By that I mean,
> in the interfaces, a Widget would have a collection of WidgetTags but the
> WidgetTag wouldn't have a reference back up to the Widget (for example).
> The driving reason I'm proposing this is that with the two way linkage the
> objects can get out of sync. For example, I can create a WidgetTag for
> widgetId 2 but put it in the collection of widgetId 1. With just the JPA
> model this wasn't a huge deal because it handled that on the back end but I
> don't think it's the right choice when designing a generic interface model
> (my opinion obviously). The "child" should be automatically associated with
> the parent it resides in.
> 
> The only real major side effect is that since items like WidgetTag would be
> dependent on their parent widget it doesn't make sense to have the
> WigetTagSevice/Repository objects. Those functions would be rolled into the
> WidgetService/Repository.
> 
> Personally, I think this will simplify things but I want to make sure
> everyone else agrees this is a good move. Let me know what you think.

+1

A directed graph model is also much easier to map onto other kinds of backend, 
such as simple document stores.


> 
> Thanks,
> Chris

Reply via email to