|
Prev: CFP: Computer Graphics and Visualization 2008 - submissions until 5 May
Next: Dalai Lama: your smiles charm but your actions harm
From: dondora on 9 Apr 2008 07:09 Hi there. I'm now modeling a simple library management system. Here are requirements making me confused. The system has to provide book search service for students. The system has to provide book lending service for students. The systme has to provide for students to be able to request books they want. So I'm going to draw a class diagram and parts of between a student class and a book class are here. Book-------------------------Student | Lending Book-------------------------Student | Search Book-------------------------Student | RequestBook But if I do like this, the class diagram looks so complex between the book and the student class. And I think probably something is wrong with this modeling. Would you point me out? I appreciate you kind help~!
From: H. S. Lahman on 9 Apr 2008 10:00 Responding to dondora... This sounds very much like a homework problem, so I will limit the response to hints. > I'm now modeling a simple library management system. > Here are requirements making me confused. > > The system has to provide book search service for students. > The system has to provide book lending service for students. > The systme has to provide for students to be able to request books > they want. The 1st and 3rd are basically the same; they just navigate the association in different directions. The association object's responsibility is to manage the association. There is no rule that requires association objects to have simple responsibilities. Corollary: association object can manage the association in different ways. Try envisioning a more abstract (more general) notion of what the association object manages. The 2nd implies that the library wants to keep track of books that are loaned to students. That suggests a dedicated collection (i.e., subsets of students and books that are dynamic as books are loaned and returned). -- There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl(a)pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info(a)pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH
From: Lee Riemenschneider on 14 Apr 2008 16:49 On Wed, 9 Apr 2008 15:00:41 UTC, "H. S. Lahman" <hsl(a)pathfindermda.com> wrote: > Responding to dondora... > > This sounds very much like a homework problem, so I will limit the > response to hints. > > > I'm now modeling a simple library management system. > > Here are requirements making me confused. > > > > The system has to provide book search service for students. > > The system has to provide book lending service for students. > > The systme has to provide for students to be able to request books > > they want. > > The 1st and 3rd are basically the same; they just navigate the > association in different directions. > This might not be true in the following cases: 1) A student wants to be put on a waiting list for a checked out book; 2) A student wants to request that the library obtain a copy of a book, that it doesn't already catalogue; OTOH, maybe I'm not paying enough attention to the word, "simple". :-) -- Lee W. Riemenschneider GO BOILERS! Running eComStation (eCS)(the latest incarnation of OS/2) Buy eCS everyone! Buy it now! http://www.ecomstation.com
From: H. S. Lahman on 15 Apr 2008 10:16
Responding to Riemenschneider... >> This sounds very much like a homework problem, so I will limit the >> response to hints. >> >>> I'm now modeling a simple library management system. >>> Here are requirements making me confused. >>> >>> The system has to provide book search service for students. >>> The system has to provide book lending service for students. >>> The systme has to provide for students to be able to request books >>> they want. >> The 1st and 3rd are basically the same; they just navigate the >> association in different directions. >> > This might not be true in the following cases: > 1) A student wants to be put on a waiting list for a checked out book; > 2) A student wants to request that the library obtain a copy of a > book, that it doesn't already catalogue; > > OTOH, maybe I'm not paying enough attention to the word, "simple". :-) I think we are both wrong. B-) I was wrong about the navigation because I misread the 1st behavior to mean one needed to find specific students for a given book. But for a Book to do that really doesn't make much sense compared to the more natural notion that students need to determine if a book is in the collection at all. So I think both are navigating in the same direction. Given that, I would argue it is a trick question and the 1st and 3rd are exactly the same: both search the same <full> collection of [Book] seeking a particular member. The first determines if the collection contains the book while the second implies doing something with a book known to be in the collection. Either way, the purpose of the search navigation is the client's problem and it determines what the client does with the results of the search. Thus your action (1) is what the client does in response to the second access (request existing Book) while (2) is what the client does in response to the first access (search failed). IOW, one would probably implement both with a single collection.find(bookID). Assuming the client is [Library], then we might have: Library::checkIfBookIsInLibrary(bookID) Book b = myBooks.find(bookID) if (b == NULL) return FALSE return TRUE Library::putOnWaitingList(student, bookID) Book b = myBook.find(bookID) if (b == NULL) // DbC error if (b.checkedOut) // put student on waiting list else // reserve book and notify Student it is available. P.S. I opt for homework problem == simple. P.P.S. It's been slow week on this forum. -- There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl(a)pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info(a)pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH |