The Artima Developer Community
Sponsored Link

Java Buzz Forum
Using AO to handle roles

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Using AO to handle roles Posted: May 28, 2004 1:24 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Using AO to handle roles
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
Adrian Colyer (man he is on a role since he started a blog!), has just written about the classic mixed-role cohesion problem. This is explained in the book Fundamentals of Object-Oriented Design in UML. The example revolves around a Person and a Dog. You don't want to tie them together directly, as what about tying a Person and their house, phone, tv, spouse, etc. It never ends. This is the classic problem with roles. Adrian shows that his adverb/adjective analogy can fit in here, and in fact we want to create a dog-owning person in this case. However we don't want them tied, as we also may want an organization that owns dogs etc. He spells out an elegant way to use AO, and intratype declarations (mixins) to do the job nicely! /** * not a person in sight... */ public aspect DogOwnership { public interface IDogOwner {}; private int IDogOwner.numDogsOwned; public int IDogOwner.getNumDogsOwned() { return numDogsOwned; } } public aspect PersonOwnsDog { declare parents : Person implements DogOwnership.IDogOwner; } This is why I wanted Anders to allow for mixins in C# :) Read Adrian in Person owns Dog....

Read: Using AO to handle roles

Topic: Accessing DB2 Everyplace Using J2ME Devices, Part 1 Previous Topic   Next Topic Topic: Boilerplate: attorneys love it, hackers hate it

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use