Presentation is loading. Please wait.

Presentation is loading. Please wait.

Com S 362: Object-Oriented Analysis and Design Class, Responsibilities, Collaborations, CRC Cards Com S 362: Object-Oriented Analysis and Design Oct 18,

Similar presentations


Presentation on theme: "Com S 362: Object-Oriented Analysis and Design Class, Responsibilities, Collaborations, CRC Cards Com S 362: Object-Oriented Analysis and Design Oct 18,"— Presentation transcript:

1 Com S 362: Object-Oriented Analysis and Design Class, Responsibilities, Collaborations, CRC Cards Com S 362: Object-Oriented Analysis and Design Oct 18, 2006

2 Com S 362: Object-Oriented Analysis and Design From Analysis to Design Input artifacts: use cases, domain model, system sequence diagrams Refine these artifacts, one step closer to the executable system

3 Com S 362: Object-Oriented Analysis and Design Key Steps Finding entities in your system –These entities will become classes Assigning responsibilities to these classes –Often become operations that a class support Identifying collaborations between classes –Represent relationships between classes –Often describe dependence

4 Com S 362: Object-Oriented Analysis and Design Relation to Previous Phases Analysis: Domain Model Identify conceptual classes Identify attributes of conceptual classes Identify association between conceptual classes Design: Class Diagrams Identify solution classes Identify responsibilities of solution classes Identify collaboration between solution classes

5 Com S 362: Object-Oriented Analysis and Design Finding Solution Classes Conceptual Classes in Domain Model –Not every conceptual class may be required –Example: Copyright law, a conceptual class, but may not be a solution class –Some conceptual classes may become attributes –Example: Library, a conceptual class, but may just be an attribute, if only name is useful Use cases

6 Com S 362: Object-Oriented Analysis and Design Example: Domain Model Initial Class List: Patron, Book, Fine, Librarian, Manager, Library, Partner Library

7 Com S 362: Object-Oriented Analysis and Design Refining Class List: Redundancy Initial class list: patron, book, fine, librarian, manager, library, partner library Question: Are all user types (patron, librarian, manager) necessary?

8 Com S 362: Object-Oriented Analysis and Design Refining Class List: Redundancy Alternative: can we have a generic user type with different permissions for patrons, librarians, and managers? Refined class list : user, permissions, book, fine, library, partner library

9 Com S 362: Object-Oriented Analysis and Design Refining Class List: Redundancy Alternative rejected: Coupling between different user types in one class Change in any user type’s behavior affects this class Refined class list : patron, book, fine, librarian, manager, library, partner library Low coupling [Larman page 299-301]

10 Com S 362: Object-Oriented Analysis and Design Refining Class List: Relations Initial class list: patron, book, fine, librarian, manager, library, partner library Question: Are patrons, librarians, managers related?

11 Com S 362: Object-Oriented Analysis and Design Refining Class List: Relations Alternative: Can we have another class user, the patrons, librarians, managers are all users at some level? Refined class list : user, patron, book, fine, librarian, manager, library, partner library

12 Com S 362: Object-Oriented Analysis and Design Refining Class List: Attribute or Class Initial class list: patron, book, fine, librarian, manager, library, partner library Question: Is fine a property of a patron? Can fines exist by themselves?

13 Com S 362: Object-Oriented Analysis and Design Refining Class List: Attribute or Class Alternative: Can we have fines as an attribute of patrons? Refined class list : patron, book, librarian, manager, library, partner library

14 Com S 362: Object-Oriented Analysis and Design Refining Class List: Discovery Initial class list: patron, book, fine, librarian, manager, library, partner library Question: Does library owns items other than books?

15 Com S 362: Object-Oriented Analysis and Design Refining Class List: Discovery Alternative: Can we have another set of classes videos, CDs, DVDs? Refined class list: patron, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library

16 Com S 362: Object-Oriented Analysis and Design Refining Class List: 1 st Change Initial class list: patron, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library Question: Is library ever going to own anything that we have not thought about here?

17 Com S 362: Object-Oriented Analysis and Design Refining Class List: 1 st Change Alternative: Can we have another type Item, an abstraction of books, videos, CDs, DVDs? Refined class list: patron, Item, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library

18 Com S 362: Object-Oriented Analysis and Design Refining Class List: 2 nd Change Initial class list: patron, Item, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library Question: Is library ever going to support multiple level of memberships? e.g, platinum can borrow unlimited, gold can borrow 25 items, silver can borrow 5 items, bronze can borrow 1 item only

19 Com S 362: Object-Oriented Analysis and Design Refining Class List: 2 nd Change Alternative: Can we have another type IPatron, an abstraction of different type of patrons? Refined class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library

20 Com S 362: Object-Oriented Analysis and Design Refining Class List: 3 rd Change Initial class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, librarian, manager, library, partner library Question: Is library ever going to support different type of librarians with different job responsibilities? Some will work at circulation desk, other kind at the reference desk, yet another kind are allowed to modify the library catalog and add new books.

21 Com S 362: Object-Oriented Analysis and Design Refining Class List: 3 rd Change Alternative: Can we have another type ILibrarian, an abstraction of different type of librarians? Refined class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, ILibrarian, librarian, manager, library, partner library

22 Com S 362: Object-Oriented Analysis and Design Assign Responsibilities Where do responsibilities come from? –Use case scenarios –Objective is to fulfill user’s goals

23 Com S 362: Object-Oriented Analysis and Design Example Scenario Success Scenarios #1: A patron approaches the library administration machine with books to borrow. The patron enters her/his membership information. The machine verifies the membership information. The patrons enters the book information. The machine updates the library catalog to reflect that the book is checked out. The machine outputs a receipt containing the due date. The patron receives a receipt from the machine. Responsibilities are underlined

24 Com S 362: Object-Oriented Analysis and Design Identified Responsibilities Prompt and store membership information Verify membership information Prompt and store book information Update the library catalog Output a receipt {Due date} Class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, ILibrarian, librarian, manager, library, partner library

25 Com S 362: Object-Oriented Analysis and Design Prompt and Record Member Info Do we need to refine class list? –How to prompt? –How to store? Class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, ILibrarian, librarian, manager, library, partner library

26 Com S 362: Object-Oriented Analysis and Design Classic case for 3-tiered architecture User Interface IPatron, patron, Item, book, videos, CDs, DVDs, fine, ILibrarian, librarian, manager, library, partner library Database

27 Com S 362: Object-Oriented Analysis and Design Information Expert Which class has the necessary information to prompt? Which class has the necessary information to store? Class list: IPatron, patron, Item, book, videos, CDs, DVDs, fine, ILibrarian, librarian, manager, library, partner library, User Interface, Database

28 Com S 362: Object-Oriented Analysis and Design Assigning Responsibilities Class Name: UI Subclasses: Super classes: Responsibilities Collaborators Prompt IPatron Class Name: IPatron Subclasses: Patron Super classes: Responsibilities Collaborators Store

29 Com S 362: Object-Oriented Analysis and Design Summary Identifying Solution Classes –Based on domain models –Based on use cases Refining Solution Class List Assigning Responsibilities to Classes


Download ppt "Com S 362: Object-Oriented Analysis and Design Class, Responsibilities, Collaborations, CRC Cards Com S 362: Object-Oriented Analysis and Design Oct 18,"

Similar presentations


Ads by Google