Analysis Modeling CpSc 372: Introduction to Software Engineering Jason O. Hallstrom jasonoh@cs.clemson.edu Authorship Disclaimer. These slides are intended to serve as teaching instruments for an undergraduate course in Software Engineering. While the slides were formatted by Dr. Hallstrom, the content is compiled from other sources, including the readings listed on the course website, Dr. Pressman’s Software Engineering textbook, and various internet materials. In almost every case, the ideas belong to someone other than Dr. Hallstrom. Indeed, text is often quoted verbatim without an explicit citation (to improve the readability of the slides). The original authors retain all copyrights. If you are interested in citing any of the material in these slides, please contact Dr. Hallstrom for the original source(s). DO NOT CITE THIS PRESENTATION. THE CONTENT SHOULD NOT BE ATTRIBUTED TO DR. HALLSTROM. SEE DR. HALLSTROM IF YOU HAVE ANY QUESTIONS. CpSc 372 The Analysis Model The analysis model consists of a wide variety of diagrammatic forms used to bridge an important gap. System Description Design Model Analysis Model System information System function System behaviors Purpose: Describe what the customer wants built Establish the foundation for the software design Provide a set of validation requirements CpSc 372 Some Rules of Thumb Make sure all points of view are covered Every element should add value Keep it simple Maintain a high level of abstraction Focus on the problem domain Minimize system coupling CpSc 372 Analysis Modeling Approaches Structured Analysis: Models data elements Object-Oriented Analysis Attributes Relationships Models processes that transform data Models analysis classes Data Processes Models class collaborations Techniques from both approaches are typically used in practice. CpSc 372 A Roadmap We are going to examine some of the key tools used for creating an analysis model. General Use-cases Use-case diagrams Activity diagrams Swimlane diagrams Structured Analysis Data object diagrams ERD diagrams Data flow diagrams Process specifications These tools are not specific to either structured analysis or OO analysis. OO Analysis Class diagrams Packages CRC cards Sequence Diagrams CpSc 372 Use-Cases “[Use-cases] are simply an aid to defining what exists outside the system (actors) and what should be performed by the system (use-cases).” Key Points: –Ivar Jacobson A scenario that describes a thread of usage for achieving a functional requirement Actors represent roles people, devices, or external systems play System internals are ignored Example: See Pressman Chapter 8, Section 8.5.1, pg. 190 CpSc 372 The Key Elements of a Use-Case A descriptive name for the scenario The primary actor in the scenario Remember why we’re interested in use-cases! How was the scenario initiated? The “sunny day” scenario What assumptions are being made? Scenario trigger What is the actor trying to accomplish? Scenario pre-conditions Who is interacting with the system? The primary actor’s goal e.g., “Customer Checkout”, “Browse Products” In the best case, how does the user interact with the system? Exceptions What might go wrong? CpSc 372 Developing a Use-Case What are the main tasks or functions that are performed by the actor? What system information will the actor acquire, produce or change? Will the actor have to inform the system about changes in the external environment? Does the actor wish to be informed about unexpected changes? … CpSc 372 Example: The Online Bookstore Consider the following excerpt from the initial scope document of a system that will be used by a local bookseller. The Online Bookstore System (OBS) will be a web-based application that allows customers to browse and purchase online product offerings. The application will support the notion of an online shopping cart, similar to other online retailers such as Amazon.com. The checkout features of the system will be integrated with our credit card transaction processor, as well as our internal billing system. The system will also provide an administrator-view that will allow authorized employees to view and administer products, customers, and orders. Based on this description, what are the key use-cases? CpSc 372 Activity Diagrams ent er password and user ID For complex use-cases, the process flow may be difficult to understand. valid passwor ds/ ID invalid passwor ds/ ID select major f unct ion prompt f or reent ry ot her f unct ions m ay also be select ed Activity diagrams provide a graphical view of the interactions in a usecase. input t r ies r em ain selec t surveillance no input t r ies r em ain t hum bnail views select a specif ic cam er a select specif ic camera - t humbnails select camera icon Example: See Pressman Chapter 8, Section 8.5.2, pg. 192 view camera out put in labelled window prompt f or anot her v iew exit t his f unct ion see anot her cam er a CpSc 372 Swimlane Diagrams In some cases, it help to indicate which actors (or analysis classes) are responsible for which activities. A swimlane diagram serves this purpose. Example: See Pressman Chapter 8, Section 8.5.3, pg. 193 homeowner c a m e ra i n t e rf a c e ent er pas sword and us er ID valid p asswo r d s/ ID in valid p asswo r d s/ ID s elec t m ajor f unc t ion o t h er f u n ct io n s m ay also b e select ed prom pt f or reent ry in p u t t r ies r em ain select s urveillanc e n o in p u t t r ies r em ain t h u m b n ail views select a sp ecif ic cam er a s elec t s pecif ic c am era - t hum bnails selec t cam era ic on generat e v ideo out put view c am era out put in labelled window prom pt f or anot her v iew exit t h is f u n ct io n see an o t h er cam er a CpSc 372 Use-Case Diagrams You’ll probably have a lot of use-cases! Online Bookstore System Browse products Use case diagrams (UCD) provide a diagrammatic table of contents, and a high-level overview of the system. Add products to shopping cart View shopping cart Customer Diagrams Show: Actors Use-cases Relationships among them Credit card transaction processor Checkout Billing system Example UCD