文档详情

华师大面向对象程序设计-Lec14_CaseStudy_Library System.ppt

发布:2017-04-09约2.13万字共66页下载文档
文本预览下载声明
* Transforming local to attribute visibility This is an example where visibility exists between Terminal and Session. In this example, local visibility is transformed to attribute visibility. public class Terminal { private BookEntrySession bookEntrySession; … public void makeNewBookEntry() { BookEntrySession session = new BookEntrySession(catalog); this.bookEntrySession = session; bookEntrySession. initiate(); } * Building a class diagram Identify all the classes participating in the software solution. Do this by analyzing the interaction diagrams. Draw them in a class diagram. Duplicate the attributes from the associated concepts in the Domain Model. Add method names by analyzing the interaction diagrams. BookEntrySession :Terminal :BookEntrySession 1: makeNewBook(…) makeNewBook() If the message makeNewBook() is sent to an instance of class BookEntrySession, then class BookEntrySession must define a makeNewBook() method. * Method names and multiobjects The add() message to the multi-object should be interpreted as a message to the container/ collection object. The add() method is not part of class Book. b: Book 2.1: create (…) 2.2: add (b) :Book :Catalog * Class diagram LibraryClerk Accesses Captures 1 1 1 * 1 Book author Accesses Contained-in 1 1 * Catalog makeNewBook() books: vector; Terminal makeNewBookEntry() addBook() endBookEntry() Uses 1 1 PrintedItem title publisher year display() BookEntrySession makeNewBook() Session +initiate(): void +becomeComplete(): void +isComplete(): Boolean -isComplete: Boolean * On UML class diagram notation Symbols +/- define public/private members respectively. Symbol # defines protected members (not used here). Type of attributes/methods is optional. Parameter information is optional. Session is a superclass to BookEntrySession. BookEntrySession makeNewBook() Session +initiate(): void +becomeComplete(): void +isComplete(): Boolean -isComplete: Boolean * On UML class diagram notation (cont.) PrintedItem i
显示全部
相似文档