SlideShare a Scribd company logo
1 of 51
Simple Address Book
Case Study
Lecture 4
UML
Huma Ayub
Department of Software Engineering
Requirements and User Interface
• Software to be designed is a program that
can be used to maintain an address book.
• An address book holds a collection of
entries, each recording a person's first and
last names, address, city, state, zip, and
phone number.
Requirements
Features
• add a new person to an address book
• edit existing information about a person (except the
person's name)
• delete a person
• Sort the entries in the address book alphabetically by
last name (with ties broken by first name if necessary)
• ZIP code (with ties broken by name if necessary).
• print out all the entries in the address book in "mailing
label" format.
Requirements
• It must be possible to create a new address
book
• to open a disk file containing an existing address
book
• to close an address book and to save an
address book to a disk file
• Using standard New, Open, Close, Save and
Save As ...
• File menu options. The program's File menu will
also have a Quit option to allow closing all open
address books and terminating the program.
Requirements
• The initial requirements call for the program to only be
able to work with a single address book at a time;
therefore, if the user chooses the New or Open menu
option, any current address book will be closed before
creating/opening a new one.
• A later extension might allow for multiple address books
to be open, each with its own window which can be
closed separately, with closing the last open window
resulting in terminating the program. In this case, New
and Open will result in creating a new window, without
affecting the current window.
Requirements
• The program will keep track of whether
any changes have been made to an
address book since it was last saved, and
will offer the user the opportunity to save
changes when an address book is closed
either explicitly or as a result of choosing
to create/open another or to quit the
program
Requirements
• The program will keep track of the file that the
current address book was read from or most
recently saved to
• will display the file's name as the title of the main
window, and will use that file when executing the
Save option.
• When a New address book is initially created,
its window will be titled "Untitled", and a Save
operation will be converted to Save As ... - i.e.
the user will be required to specify a file.
User Interface
Use Cases for a Simple Address
Book
Analysis
Analysis
• An initial reading of the use cases suggests that the following will be
part of the system.
• A single entity object representing the current address book that the
program is working with (AddressBook).
• An arbitrary number of entity objects, each representing one of the
people that is in the current address book (Person).
• A boundary object representing the interface between the address
book system and the human user (AddressBookGUI).
• A boundary object representing the interface between the address
book system and the file system on disk (FileSystem).
• A controller object that carries out the use cases in response to user
gestures on the GUI (AddressBookController).
DESIGN (CRC Card)
CRC CARD
Class AddressBook
The CRC Cards for class AddressBook
are left as an exercise to the student
Design
Sequence Diagram
Flows of Events for Individual
Use Cases
Edit a Person Use Case Sequence
Diagram
Delete a Person Use Case Sequence
Diagram
Sort Entries By Name Use Case
Sequence Diagram
Sort Entries By Zip Use Case Sequence
Diagram
Open Existing Address Book Use Case
Sequence Diagram
Assignment
Save Address Book As ... Use Case
Sequence Diagram
The Sequence Diagram for the Save
Address Book As ... Use Case is left as
an exercise to the student
• Design (Class Diagram)
Classes
• AddressBookApplication - main class for the
application; responsible for creating the
FileSystem and GUI objects and starting up the
application.
• MultiInputPane - a utility class for reading
multiple values at a single time.
• Person.CompareByName - Comparator for
comparing two Person objects by name (used
for sorting by name).
• Person.CompareByZip - Comparator for
comparing two Person objects by zip (used for
sorting by name).
Relationship
• The following relationships hold between the objects:
• The main application object is responsible for creating a single file system
object and a single controller object.
• The file system object is responsible for saving and re-loading address
books
• The controller object is responsible for creating a single GUI object.
• The controller object is responsible for initially creating an address book
object, but the GUI is henceforth responsible for keeping track of its current
address book - of which it only has one at any time.
• The GUI object and the address object are related by an observer-
observable relationship, so that changes to the address book content lead
to corresponding changes in the display
• The address book object is responsible for creating and keeping track of
person objects, of which there can be many in any given address book.
• A MultiInputPane object is used by the controller to allow the user to enter
multiple items of data about a person.
• A comparator object of the appropriate kind is used by the address book
object when sorting itself.
CLASS Diagram
Detailed Design and Implementation
Detailed Class Design
Class AddressBook
Class AddressBookApplication
AddressBookGUI
Class FileSystem
Person
Assignment
The detailed design of class
AddressBookController is left as an
exercise to the student
Code for Simple Address Book
Example
• /*
• * AddressBookApplication.java
• *
• * Main program for address book application
• *
• * Copyright (c) 2001, 2003, 2005 - Russell C. Bjork
• *
• */
• import java.awt.Frame;
• import java.awt.event.WindowEvent;
• // The next line is only needed on the Mac platform - comment out
• // if compiling on some other platform (but comment back in and recompile
• // before moving final version to server)
• import com.apple.eawt.*;
• /** Main class for the Address Book example
• */
• }
•
•
Code for Simple Address Book
Example
• public class AddressBookApplication
• {
• /** Main method for program
• */
• public static void main(String [] args)
• {
• FileSystem fileSystem = new FileSystem();
• AddressBookController controller = new AddressBookController(fileSystem);
• AddressBookGUI gui = new AddressBookGUI(controller, new AddressBook());
• gui.show();
•
• // Register a Mac quit handler - comment out if compiling on some
• // other platform (but comment back in and recompile
• // before moving final version to server)
•
• com.apple.eawt.Application application =
• com.apple.eawt.Application.getApplication();
• application.addApplicationListener(new ApplicationAdapter() {
• public void handleQuit(ApplicationEvent e)
• {
• e.setHandled(false);
• quitApplication();
• }
• });
Code for Simple Address Book
Example
• /** Terminate the application (unless cancelled by the user)
• */
• public static void quitApplication()
• {
• // When the user requests to quit the application, any open
• // windows must be closed
• Frame [] openWindows = Frame.getFrames();
• for (int i = 0; i < openWindows.length; i ++)
• {
• // Attempt to close any window that belongs to this program
•
• if (openWindows[i] instanceof AddressBookGUI)
• {
• openWindows[i].dispatchEvent(new WindowEvent(
•
openWindows[i],
•
•
Code for Simple Address Book
Example
• WindowEvent.WINDOW_CLOSING));
•
• // If the window is still showing, this means that this attempt
• // to close the window was cancelled by the user - so abort the
• // quit operation
•
• if (openWindows[i].isShowing())
• return;
• }
• }
• // If we get here, all open windows have been successfully closed
• // (i.e. the user has not cancelled an offer to save any of them).
• // Thus, the application can terminate.
•
• System.exit(0);
• }
• }
Testing
Maintenance
Maintenance
• The Print Entries Use Case currently sends
printed output to System.out. Alternately, it could
send its output to a file, chosen by the user in
response to a file dialog.
• It was noted in the orginal requirements that the
program might be modified to allow multiple
address books to be open at the same time -
each in its own window. This might entail the
following changes:
Maintenance
• The Create New Address Book and Open Existing Address Book
Use Cases would no longer close the current address book. Instead,
they would create a new copy of the GUI, with its own address book
(either a newly created, empty one, or one read from a file specified
by the user.) There would thus be two (or more) windows visible on
the screen.
• A new Close Address Book Use Case would be added to allow the
user to close a single window (and its associated address book).
This could be initiated by a new Close option in the File menu, or by
clicking the close box for the window. It would offer to save changes,
if necessary, and then close the window. If the window that is closed
is the last open window in the program, then the program should be
terminated as well; otherwise, the program would continue running
with the remaining window(s) visible.
Maintenance
•
• The code that is activated when the close box for the
window is clicked would be the Close Address Book Use
Case described above, instead of the Quit Program Use
Case.
• The Quit Program Use Case (activated from the Quit
item in the File menu) would need to cause all open
windows to be closed, with appropriate offers to save
changes, unless the user cancels the operation for any
window. If the user cancels the save for any window, the
entire use case would terminate at once, without
attempting to close additional windows.
Maintenance
• A facility might be created that would allow the
user to search for the occurrence of some
character string anywhere in the information
about a person. For example, searching for the
string "Buffalo" might find Boris Buffalo or a
person living in Buffalo, NY; searching for the
string "0191" might find a person living in ZIP
code 01915 or a person whose phone number is
555-0191, etc. This might entail adding two new
use cases: Find and Find Again.

More Related Content

Similar to LECTURE 4 alpha.ppt

Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI PresentationAjeeth Pingle
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTnikshaikh786
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptbharatt7
 
chapter 1 software design.pptx
chapter 1 software design.pptxchapter 1 software design.pptx
chapter 1 software design.pptxrecoveraccount1
 
task manager presentation in Operating System
task manager presentation in Operating System task manager presentation in Operating System
task manager presentation in Operating System FariaChaudhry6
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxurvashipundir04
 
Exception Handling ,templates in C++
Exception Handling ,templates in C++Exception Handling ,templates in C++
Exception Handling ,templates in C++jamilmalik19
 
iOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersiOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersRyanISI
 
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptxChapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptxnoonoboom
 
Python Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IPython Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IDUSPviz
 

Similar to LECTURE 4 alpha.ppt (20)

Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Syncitall
SyncitallSyncitall
Syncitall
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI Presentation
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.ppt
 
chapter 1 software design.pptx
chapter 1 software design.pptxchapter 1 software design.pptx
chapter 1 software design.pptx
 
Lec02
Lec02Lec02
Lec02
 
task manager presentation in Operating System
task manager presentation in Operating System task manager presentation in Operating System
task manager presentation in Operating System
 
DITEC - Software Engineering
DITEC - Software EngineeringDITEC - Software Engineering
DITEC - Software Engineering
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
 
Exception Handling ,templates in C++
Exception Handling ,templates in C++Exception Handling ,templates in C++
Exception Handling ,templates in C++
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
iOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersiOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for Beginners
 
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptxChapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
 
Python Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IPython Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part I
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Welcome to React.pptx
Welcome to React.pptxWelcome to React.pptx
Welcome to React.pptx
 
Angular meteor presentation
Angular meteor presentationAngular meteor presentation
Angular meteor presentation
 

Recently uploaded

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

LECTURE 4 alpha.ppt

  • 1. Simple Address Book Case Study Lecture 4 UML Huma Ayub Department of Software Engineering
  • 2. Requirements and User Interface • Software to be designed is a program that can be used to maintain an address book. • An address book holds a collection of entries, each recording a person's first and last names, address, city, state, zip, and phone number.
  • 3. Requirements Features • add a new person to an address book • edit existing information about a person (except the person's name) • delete a person • Sort the entries in the address book alphabetically by last name (with ties broken by first name if necessary) • ZIP code (with ties broken by name if necessary). • print out all the entries in the address book in "mailing label" format.
  • 4. Requirements • It must be possible to create a new address book • to open a disk file containing an existing address book • to close an address book and to save an address book to a disk file • Using standard New, Open, Close, Save and Save As ... • File menu options. The program's File menu will also have a Quit option to allow closing all open address books and terminating the program.
  • 5. Requirements • The initial requirements call for the program to only be able to work with a single address book at a time; therefore, if the user chooses the New or Open menu option, any current address book will be closed before creating/opening a new one. • A later extension might allow for multiple address books to be open, each with its own window which can be closed separately, with closing the last open window resulting in terminating the program. In this case, New and Open will result in creating a new window, without affecting the current window.
  • 6. Requirements • The program will keep track of whether any changes have been made to an address book since it was last saved, and will offer the user the opportunity to save changes when an address book is closed either explicitly or as a result of choosing to create/open another or to quit the program
  • 7. Requirements • The program will keep track of the file that the current address book was read from or most recently saved to • will display the file's name as the title of the main window, and will use that file when executing the Save option. • When a New address book is initially created, its window will be titled "Untitled", and a Save operation will be converted to Save As ... - i.e. the user will be required to specify a file.
  • 9. Use Cases for a Simple Address Book
  • 11. Analysis • An initial reading of the use cases suggests that the following will be part of the system. • A single entity object representing the current address book that the program is working with (AddressBook). • An arbitrary number of entity objects, each representing one of the people that is in the current address book (Person). • A boundary object representing the interface between the address book system and the human user (AddressBookGUI). • A boundary object representing the interface between the address book system and the file system on disk (FileSystem). • A controller object that carries out the use cases in response to user gestures on the GUI (AddressBookController).
  • 12.
  • 14. CRC CARD Class AddressBook The CRC Cards for class AddressBook are left as an exercise to the student
  • 15.
  • 16.
  • 17.
  • 18.
  • 20. Flows of Events for Individual Use Cases
  • 21. Edit a Person Use Case Sequence Diagram
  • 22. Delete a Person Use Case Sequence Diagram
  • 23. Sort Entries By Name Use Case Sequence Diagram
  • 24. Sort Entries By Zip Use Case Sequence Diagram
  • 25.
  • 26.
  • 27. Open Existing Address Book Use Case Sequence Diagram
  • 28.
  • 29.
  • 30. Assignment Save Address Book As ... Use Case Sequence Diagram The Sequence Diagram for the Save Address Book As ... Use Case is left as an exercise to the student
  • 31. • Design (Class Diagram)
  • 32. Classes • AddressBookApplication - main class for the application; responsible for creating the FileSystem and GUI objects and starting up the application. • MultiInputPane - a utility class for reading multiple values at a single time. • Person.CompareByName - Comparator for comparing two Person objects by name (used for sorting by name). • Person.CompareByZip - Comparator for comparing two Person objects by zip (used for sorting by name).
  • 33. Relationship • The following relationships hold between the objects: • The main application object is responsible for creating a single file system object and a single controller object. • The file system object is responsible for saving and re-loading address books • The controller object is responsible for creating a single GUI object. • The controller object is responsible for initially creating an address book object, but the GUI is henceforth responsible for keeping track of its current address book - of which it only has one at any time. • The GUI object and the address object are related by an observer- observable relationship, so that changes to the address book content lead to corresponding changes in the display • The address book object is responsible for creating and keeping track of person objects, of which there can be many in any given address book. • A MultiInputPane object is used by the controller to allow the user to enter multiple items of data about a person. • A comparator object of the appropriate kind is used by the address book object when sorting itself.
  • 35. Detailed Design and Implementation Detailed Class Design
  • 41. Assignment The detailed design of class AddressBookController is left as an exercise to the student
  • 42. Code for Simple Address Book Example • /* • * AddressBookApplication.java • * • * Main program for address book application • * • * Copyright (c) 2001, 2003, 2005 - Russell C. Bjork • * • */ • import java.awt.Frame; • import java.awt.event.WindowEvent; • // The next line is only needed on the Mac platform - comment out • // if compiling on some other platform (but comment back in and recompile • // before moving final version to server) • import com.apple.eawt.*; • /** Main class for the Address Book example • */ • } • •
  • 43. Code for Simple Address Book Example • public class AddressBookApplication • { • /** Main method for program • */ • public static void main(String [] args) • { • FileSystem fileSystem = new FileSystem(); • AddressBookController controller = new AddressBookController(fileSystem); • AddressBookGUI gui = new AddressBookGUI(controller, new AddressBook()); • gui.show(); • • // Register a Mac quit handler - comment out if compiling on some • // other platform (but comment back in and recompile • // before moving final version to server) • • com.apple.eawt.Application application = • com.apple.eawt.Application.getApplication(); • application.addApplicationListener(new ApplicationAdapter() { • public void handleQuit(ApplicationEvent e) • { • e.setHandled(false); • quitApplication(); • } • });
  • 44. Code for Simple Address Book Example • /** Terminate the application (unless cancelled by the user) • */ • public static void quitApplication() • { • // When the user requests to quit the application, any open • // windows must be closed • Frame [] openWindows = Frame.getFrames(); • for (int i = 0; i < openWindows.length; i ++) • { • // Attempt to close any window that belongs to this program • • if (openWindows[i] instanceof AddressBookGUI) • { • openWindows[i].dispatchEvent(new WindowEvent( • openWindows[i], • •
  • 45. Code for Simple Address Book Example • WindowEvent.WINDOW_CLOSING)); • • // If the window is still showing, this means that this attempt • // to close the window was cancelled by the user - so abort the • // quit operation • • if (openWindows[i].isShowing()) • return; • } • } • // If we get here, all open windows have been successfully closed • // (i.e. the user has not cancelled an offer to save any of them). • // Thus, the application can terminate. • • System.exit(0); • } • }
  • 48. Maintenance • The Print Entries Use Case currently sends printed output to System.out. Alternately, it could send its output to a file, chosen by the user in response to a file dialog. • It was noted in the orginal requirements that the program might be modified to allow multiple address books to be open at the same time - each in its own window. This might entail the following changes:
  • 49. Maintenance • The Create New Address Book and Open Existing Address Book Use Cases would no longer close the current address book. Instead, they would create a new copy of the GUI, with its own address book (either a newly created, empty one, or one read from a file specified by the user.) There would thus be two (or more) windows visible on the screen. • A new Close Address Book Use Case would be added to allow the user to close a single window (and its associated address book). This could be initiated by a new Close option in the File menu, or by clicking the close box for the window. It would offer to save changes, if necessary, and then close the window. If the window that is closed is the last open window in the program, then the program should be terminated as well; otherwise, the program would continue running with the remaining window(s) visible.
  • 50. Maintenance • • The code that is activated when the close box for the window is clicked would be the Close Address Book Use Case described above, instead of the Quit Program Use Case. • The Quit Program Use Case (activated from the Quit item in the File menu) would need to cause all open windows to be closed, with appropriate offers to save changes, unless the user cancels the operation for any window. If the user cancels the save for any window, the entire use case would terminate at once, without attempting to close additional windows.
  • 51. Maintenance • A facility might be created that would allow the user to search for the occurrence of some character string anywhere in the information about a person. For example, searching for the string "Buffalo" might find Boris Buffalo or a person living in Buffalo, NY; searching for the string "0191" might find a person living in ZIP code 01915 or a person whose phone number is 555-0191, etc. This might entail adding two new use cases: Find and Find Again.