1 / 13

Object-Oriented Modeling with Roles Bent Bruun Kristensen (without Dynamics and Experiments)

Object-Oriented Modeling with Roles Bent Bruun Kristensen (without Dynamics and Experiments). Motivation for roles. Theater: actor Me (person) = student at IT-C + member of club + student at Studie Skolen + child +.

nasim-witt
Download Presentation

Object-Oriented Modeling with Roles Bent Bruun Kristensen (without Dynamics and Experiments)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Modeling with Roles Bent Bruun Kristensen (without Dynamics and Experiments)

  2. Motivation for roles Theater: actor Me (person) = student at IT-C + member of club + student at Studie Skolen + child + ... • Objects are not isolated entities... • The motivation for roles is to allow special perspectives of phenomenon, modeled by an object. - used by other objects as a selective way of knowing and accessing - is a set of selected properties (methods) - other objects can access this set - can change dynamically - can include state (f.e. Instance variables)

  3. Notation for roles • Intrinsic object ------ Sasha • Intrinsic method ----- Name • Extrinsic method ---- School, Parents • Role instance --------- IT-CStudent, TheOnlyChild • Has or plays a role --- Sasha has or plays roles Student and Child • Subject ----------------- Me Me Name School Name School IT-CStudent Person Student Sasha Parents Parents TheOnlyChild Child

  4. Characteristics of Roles 1. Visibility: can be restricted to the methods of a role, including methods of object, excluding methods of other roles. 2. Dependency: the role cannot exist without an object. 3. Identity: an object and its actual roles is seen and can be manipulated as one entity. 4. Dynamicity: a role can be added and removed during the lifetime of an object. 5. Multiplicity: Several instances of a role may exist for an object at the same time 6. Abstractivity: Roles can be classified and organizet in generalization and aggregation hierarchies. Name School Education classification Student Person Child Parents Folkeregister classification

  5. Role Simulation Specialization Aggregation Concept Association Teacher Student Teacher Teacher Student Student Example Person Person Person - The methods as Teacher also visible when a Person is only known as a Student (+) The methods of the Student role are hidden by being a part -object, they not available from the instance of Person. (-) We need to be able to forward access to the associated object Student from the association object Person. Visibility - The methods of part-object Student cannot be defined in terms of the methods of the hole-object Person (+) The role Student is visible from the object Person, and not only vice versa. Depen- dency + - The Student object can exist independently from the Person object. - The roles Student and Teacher and the object Person are self-contained objects. Identity + Dynami- city (+) A Person cannot stop being a Teacher and become a Student (-) A Person cannot stop being a Student + Multipli- city - Several Teachers can't exist at the same time + + (+) “...the class of the object becomes a genera- lization of any of its roles” Abstrac- tivity + +

  6. The Role Concept Enroll-OO Withdraw-OO Enroll-Conference Member-id Pay-Registration-Free Name Update Display Time Location Conference-Associate (>=0) OO-Associate Program Conference • A given conference is related to a specific role of OO-Associate only and not the entire OO-Associate. • OO-Associate can be involved in a number of conferences at the same time and this number can change over time. • Enroll-Conference can use Member-id, but not vice versa.

  7. Roles of Roles Enroll-OO Speaker (>=0) Enroll-Conference Withdraw-OO Pay-Registration-Free Member-Id Registration-No Panelist (>=0) Reviewer (>=0) Session-Chair (>=0) Participant (1) Register-Conference Conference-Associate (>=0) OO-Associate Report-From-Conference Author (>=0) • Role of role, role of role of role... • Register-Conference can use Registration-No and Member-Id, but not vice versa. • Participant, Author and Reviewer are roles of Conference-Associate because various relations to a given conference are related to a specific roles only: Participant -- Conference, Author -- Paper... The same with roles of Participant: Speaker -- Session, Panelist -- Panel-Session... • The availability of the methods of the subject depends on the classification: an instance of OO-Associate with roles can be classified as OO-Associate or any role.

  8. Manuscript Specialization of roles Speaker-CV • Specialization of roles remain to be roles. • Speaker-CV is an inherited method. • Manuscript is a modified method. • Title-Of-Talk is an added method. • A sub-role is a role for a class if any of its super-roles is a role for that class. • Classes with roles may be specialized as usual. A role for a class is also a role for any subclass of the class. • If classified as Author-With-Paper, Manuscript ,Title-Of-Talk (but not from Author-Without-Paper) and Speaker-CV are all available. • If classified as Speaker, Manuscript (of Speaker) and Speaker-CV available only. Speaker Manuscript Manuscript Title-Of-Talk Title-Of-Talk Author-Without-Paper Author-With-Paper

  9. Aggregation of Roles Participant Conference-Expenses • Traveler and Hotel-Guest are roles of Conference-Associate • Supply additional methods to Conference-Associate. • Participant is a hole-role. • Traveler is a part-role. • Conference-Expenses is an emerging method. • Travel-Agency is a hidden method. • Address is a hereditary method. • Address is the same method for Hotel-Guest and Participant. • Classes with roles can be aggregated from other classes (with roles). There are no special relation between the roles of part- and hole-objects. • The hole-role and part-roles must be roles of the same class. • The role instances must be allocated for the same object of the class. • Methods of the part role can be used in the hole-role, not vice versa. • If classified as Participant,Conference-Expenses and Address available. • If classified as Hotel-Guest, Hotel-Expenses and Address available. Address Conference-Associate Address Travel-Agency Traveler Hotel-Guest Traveling- Expenses Hotel- Expenses

  10. Associations to Roles Title-Of-Talk Author-With-Paper Reviewer Author 1 From the Title-Of-Talk of Author-With-Paper through Paper-Presentation, through Paper-Submission, the Title of Paper is available. Date Status >=0 >=0 Paper-Submission 1 1 Title Author-Name 1 Paper-Presentation Paper

  11. Phone Method Roles Schedule Schedule' Registration-No Phone' Schedule'' • Schedule'' and Schedule' are method-roles for Schedule. • Invocation of Schedule' will give combination of time schedule from OO-Associate and Conference-Associate. • The relations between methods in an intrinsic object and the methods of a role are: - Registration-No is intrinsic - Phone' is extrinsic - Schedule'' is a method-role for Schedule' • If classified as Conference-Associate, methods Registration-No and Schedule' are available. • If classified as Participant, methods Phone' and Schedule'' are available. • For Participant Schedule'' is a combination of Schedule'', Schedule' and Schedule, for Conference-Associate Schedule' is a combination of Schedule' and Schedule... • Names can be identical or different. Conference-Associate Participant OO-Associate

  12. Subject Abstraction CV CV CV CV CV • A subject is an intrinsic object with its role instances. • Subject abstraction also possible for roles of roles. • Subject abstraction requires no naming conflicts among the methods of its components. • Name conflict can be resolved by classifying the subject as one of its component class or roles. • Method roles (with identical or different names) do not cause name conflicts in subject abstraction. • Whenever OO-Associate is classified as subject, the specified combination of the accumulated information and all new information is obtained by the CV method. Conference- Associate2 Conference- Associate1 Autor1 Participant1 OO-Associate-John Conference- Associate3 CV

  13. Locality Participant OO-Associate-John • Conference-Associate is meaningful only in context of Conference, it is local to Conference. • Participant is a general role, but Conference-Participant is meaningful only in context of Conference. • The availability of methods is supported by concept of locality: the methods of the enclosing class directly available. • An object of the enclosing class will always exist for instances of the local classes/roles. • Roles can be local also to other roles. • The availability of methods of local roles to roles is the same as for local roles to classes. Conference- Associate Conference- Participant Conference

More Related