• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Attributes - Navigability from type to attribute only

 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


Excerpt from Martin Fowler, UML Distilled, Chapter 4, Attributes, Page 58
[..]Attributes imply navigability from type to attribute only.Furthermore,it is implied that the type contains solely its own copy of the attribute object, implying that any type used as an attribute has value rather than reference semantics.


Please look at my next post for my queries.
Thanks in advance,
Sandeep
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I got from the paragraph above.
I find it easier to understand this from the Java Collection API.
If I consider Collection interface as a super-type of List, then probably, navigability from type to attribute would mean, the Collection interface will have a responsibility to tell us about the List, as well as it has the responsibility to update the relationship - So probably containsAll(Collection),addAll(Collection),removeAll(Collection) signifies this.


Originally posted by Desai Sandeep:
Furthermore,it is implied that the type contains solely its own copy of the attribute object,


This probably means, that Collection super-type can hold any of its sub-type objects.For instance, Collection can hold any implementation of List (ArrayList,LinkedList,AbstractList or Vector)- Is that correct?


Originally posted by Desai Sandeep:
[..]implying that any type used as an attribute has value rather than reference semantics.


This probably means, none of the Collection responsibilities return the reference of its sub-type.All the methods of the Collection, either return a primitive datatype or a Object type- Is that correct?
Please let me know your views on this.
Thanks in advance,
Sandeep
[This message has been edited by Desai Sandeep (edited May 26, 2001).]
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refresh please.
Thanks,
Sandeep
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Attributes imply navigability from the type to the attribute only." To me, this refers to encapsulation and the Uniform Access Principle.
Refer to page 93 for a discussion on value vs. reference objects.
Junilu
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by JUNILU LACAR:
"Attributes imply navigability from the type to the attribute only." To me, this refers to encapsulation and the Uniform Access Principle.
Refer to page 93 for a discussion on value vs. reference objects.
Junilu


Could you explain what Uniform Access Principle is?Also can you confirm if my above explanation is in lines with what you mean?
Also, I am not able to link this with "Value and Reference Objects" discussion.
Thanks in advance,
Sandeep

 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


Originally posted by Desai Sandeep:
[..]Attributes imply navigability from type to attribute only.Furthermore,it is implied that the type contains solely its own copy of the attribute object, implying that any type used as an attribute has value rather than reference semantics.


I think I got what the above paragraph means.
If we take an example of Order and OrderLineItem as 2 objects and a composition relationship of "Order containing one or many OrderLineItems", then this would mean OrderLineItem would be stored as one of the attributes of Order class (perhaps as a Collection).
From the specification prespective (and by Attribute definition), we can say that Order has the responsibility to tell us all the OrderLineItems for that Order, i.e. navigability is from type (Order) to attribute(OrderLineItems) only.
Also this means the type(Order) will contain its own copy of attribute(OrderLineItems).Also, since OrderLineItems is one of the types, which is used as an attribute in the Order type, it would hold instances of OrderLineItems i.e. an attribute always has value.
Since the Order contains the part(OrderLineItem) and manages the life-cycle of the part, through an attribute,the type would refer to an attribute only by value and not by reference.
Does this sound convincing?
Thanks in advance,
Sandeep
[This message has been edited by Desai Sandeep (edited May 31, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic