This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSE 335 Design Assignment 7 For this design a$ignnient, create the diagrams using Bouml and print them on paper Hand-drawn solutions will not be accepted! Hand them in at the beginning of the class se$ion next Tuesday This assignment in class Tuesday, November 9 at 10:20am When creating sequence diagrams be sure you can check off the followmg Returns are always back to the bar they were called from.
No bar ends before a bar it is callingdoes (except In the case of asynchronous calls‘ but that won't apply to ours). A Web-based Application There are many ways that weobased applications get implemented Here is one simpliﬁed scenario Suppose we are working for a bank A user goes to the bank web site. They enter their ID and password This gets sent to an authentication system. If the user is valid, a personalized main screen for the bank gets presented With various options. One option is a simple
moitgage payment calculator. It presents a screen where the user can enter a loan amount and terms The system then computes and presents a mortgage payment. The user can then return to the main menu Here's some clam for this simple application including only the associations and operations Authentication
Authenticateo : boot PresentMainMenuO
RetumMa'rnMenuO MortgagaPayment P resentFormo
OnRetumMainMenu() I haire kept this design focused on the interface components Cleartythere will be a class that represents the user and classes that represent theiraccounts. But, We elided them from this dEign. Here‘s what a sequence diagram for this example might look like: 7% :OgeniggScreen
| OnL in
09 0 Auihernicaiei) I PresentMainMenuO PresentForrriO OnValuesEnteredG |
OnRetumMainMenoO I ReturnMainMenuO a
PresentMainMenuo Here's a description of the proce$ in detail as it relates to the sequence diagram: The actor represents our user. Note that a user is not an object it's a person. That person will cause eventsto occur In Eoumly create an object of class Acton rightclick and select Edit Drawmg Settings. Set the drawmg mode to "actor" to get the actor symbol We assume
the user is seeing the opening screen for the bank whenwe start. It has already been displayed when the user connected The user enters their id and pa$word and hits the Login button. This causes the system to call the OnLogin operation on the currently displayed object
of type OpeningScreen That object calls the function Authenticate in the Authentication object. it returns true indicating the user is valid. The functionthen creates an ActiveUser object for the user. This object is dynamically created, as indicated bythe call to new and by the object being lower in the diagram Then the PresentMainMenuO operation is called to present a menu to the user
Now‘ OnLogin doesn't really "return", so I don't put a return line Events are handled and then the event handling ends The system has presented a new screen for the user and is now waiting for the user to do something The user in this case hits the Compute Mortgage Payment button This causes a new MorlgagePayment object to be created and the form for entering the information to be displayed Again, the proce$ now completg. The user enters the valuﬁ in the form and hits the Compute button. This calls the operation OnvaluﬁEnteredO on our MorlgagePaymeril object. It computes the result and calls the DisplayResultt) which outputsthe HTML for a rﬁult page. Finally, our user hits the button or link to return to the main menu. This tells the MortgagePayment object to, in turn, tell the ActiireUser object to reutrn to the main menu and that the MortgagePayment object is no longer needed. The MoitgagePayment object is deleted
because it is not longer needed. In Bouml, right click on the object and select Become Mortal to indicate that the object will be destroyed. Important Observations We don't "return" to the user You may notice that the arrows for the actor are ditferent Instead of a closed arrowhead, they have an open one This is called an "asynchronous" call. A synchronous call means a call where we have to wait for the return before proceeding This
is what normally happens in programs But, when the user selects a link or button on a web page, they don't have to wait for the function to return They can click on something else or just leave if they want. That's what "asynchronous" means if you doubleclick on the masage in Bouml, you can select asynchronous as an option. We don't consider an asynchronous call to have a return Instead, the called function would send an asynchronous message back if a response is required Someone has to know when In delete an object We never delete ActiveUser, since the actor never logs ntt. But, when they exit the mortgage payment screens the ActiveUser object next to know to delete the MorlgagePayment object II can tell when In do so by the
function ReturnMainMenu. Problems You are dwgning an online enrollment system for a major University. There is a main menu object in the system. When the studem selects the enroll option in that menu, an EnroIIStudem object is created. The process then proceeds as follows for a normal enrollment: From the main screen the student clicks the enrollment system link. An authentication screen is displayed. The user enters their login information. The security system is called In authenticate the student. The system indicates the student is authenticated A screen is presented where the student can enter the semester, course name number, and sedion they want to enroll in The student enters this intonnation and chooses to proceed The system determihsthat the student is eligible to enroll in the course They must have no administrative holds (mning money for example), no academic holds (on suspension), and must have passed all of the prerequisitﬁ torthe course Our student has no
holds and has taken CSE 231, the only prerequisite for this course. The system enrolls the student in the course. Return to the screen requesting enrollment information so the student can enroll for another class. F554 5745119.“!‘57‘ 1. Create a UML class diagram for this system include all operations. You may elide all of the attributes and all associations in this diagram. You may also omit the arguments to the functions. See the comments below to help determine what the classﬁ will be. lam
providing the diagram for the existing enrollment management system. You are not responsible for these classes, onty those necessary to create your interface. Here is the UML cla$ diagram for the University enrollment system: HasAdminiﬁraﬁveHoldsO : boot HasAcademicHoldsO : bool AddEnrolI'nent(in enrolment: Enrollment) FindEnrollment(in course : Course, in semester : stn'ng) : Enrollment FindEnrollment(in course : Course): Enrollment
GetEnrollmem(in semester : string) : lterator<Enro|lment> enrollments Enrollment
grade: string enrollments courses 1 Course AddEnroIlment(in enrollment : Enrollment) FindEnrollment(in student : Student) : Enrollment FindEnrollment(in student : Student, in semester: string) : Enrolment
GetPrereqsO : tterator<Course> prereq 2. Create a sequence diagram for the case of Bob enrolling in CSE 335 for F311 (Fall, 2011 )seclion 001 This is the ﬁrst enrollment this semester for Bob C omme nts I started With the classes, but didn't put any operations in I added the operations as I realized I needed them for the sequence diagram. This is a weooased system. When the student indicates they Wish to enroll an object is created to manage the enrollment process. Student actions call operations on this object.
You need an actor and asynchronous Wages in your diagram You may assume your application always has a pointer named "university"to the University object. You may assume you can call functions on any object you could reach through associations of multiplicity 1, but you must include the use of any iterators in your diagram Be
sure you can dﬁcflbe the proce$ of using an iterator You can determine the prerequisites for a course by creating an iterator and iterating over all of the prerequisites for a course
Enrollment recorcb are forever. They keep the current enrollment and all future enrollments as Well. Every time you want to display a web page, call a function that starts With the word "Present" Name all functions called by the user interface with names starting With ”0n". lgot my sequence diagram to print nicer; by choosing Ansi B format and telling it to print on one page You may omit the return indicators only When you are calling a function that does not call any other functions and doa not return a value
Be sure to include return values for functions that do return a value Your class diagram Will be pretty small. Your sequence diagram Will be pretty big. Mistakes to avoid The authemicati on class does not present a screen. You'll have to prowde that functionality somewhere.
Checkingthe prerequisites requires youto create and use an interator Be sure ""new gets called on it by the right function tfyou have new for the iterator called by EnrollStudent, you're wrong My solution has 27 Maw in it tfyou have a lot leﬁ than that, you're leaving something out ...
View Full Document
- Fall '10