790 likes | 900 Views
Before The Project. Chapter 7 Pragmatic Programmer. The Requirements Pit. Tip 51: Don’t Gather Requirements – Dig for Them Tip 52: Work with a User to Think Like a User Tip 53: Abstractions Live Longer than Details Tip 54: Use a Project Glossary. Overspecifying.
E N D
Before The Project Chapter 7 Pragmatic Programmer MSD Fall 2005
The Requirements Pit • Tip 51: Don’t Gather Requirements – Dig for Them • Tip 52: Work with a User to Think Like a User • Tip 53: Abstractions Live Longer than Details • Tip 54: Use a Project Glossary MSD Fall 2005
Overspecifying • Don’t be too specific. Good requirement documents remain abstract. • Requirements • Are NOT architecture • Are NOT design, NOR user interface • Are need MSD Fall 2005
The Specification Trap • Tip 57: Some Things Are Better Done than Described • Seamless approach:specification and implementation are different aspects of the same process: each should flow directly into the next, with no artificial boundaries. MSD Fall 2005
Requirements Engineering Bernd Bruegge MSD Fall 2005
System Identification • Development of a system is not just done by taking a snapshot of a scene (domain) • Definition of the system boundary • What is inside, what is outside? • How can we identify the purpose of a system? • Requirements Process • Requirements Engineering: Definition of the system in terms understood by the customer • Requirements Analysis: Technical specification of the system in terms understood by the developer. MSD Fall 2005
Requirements Engineering • Very challenging activity • Requires collaboration of people with different backgrounds • User with application domain knowledge • Developer with implementation domain knowledge • Bridging the gap between user and developer: • Scenarios: Example of the use of the system in terms of a series of interactions between the user and the system • Use cases: Abstraction that describes a class of scenarios MSD Fall 2005
Requirements Validation • Critical step in the development process, • Usually after requirements engineering or requirements analysis. Also at delivery. • Requirements validation criteria: • Correctness: • The requirements represent the client’s view. • Completeness: • All possible scenarios through the system are described, including exceptional behavior by the user or the system • Consistency: • There are functional or nonfunctional requirements that contradict each other • Realism: • Requirements can be implemented and delivered MSD Fall 2005
Additional Requirements Validation Criteria • Traceability: • Each system function can be traced to a corresponding set of functional requirements • With AOSD we can improve traceability of requirements. • Goal: can we map requirements to aspects? MSD Fall 2005
Types of Requirements Engineering • Greenfield Engineering • Development starts from scratch, no prior system exists, the requirements are extracted from the end users and the client • Triggered by user needs • Re-engineering • Re-design and/or re-implementation of an existing system using newer technology • Triggered by technology enabler • Interface Engineering • Provide the services of an existing system in a new environment • Triggered by technology enabler or new market needs Example: Eclipse as new technology enabler MSD Fall 2005
Actors • Actors constitute everything that is external to the system and that communicates and interacts with the system. • human users, external hardware and other systems • Actors communicate by sending and receiving stimuli to and from the system. Each actor has a name. • Graphical Notation: A stick figure with the name of the actor. MSD Fall 2005
Scenarios • “A narrative description of what people do and experience as they try to make use of computer systems and applications” [M. Carrol, Scenario-based Design, Wiley, 1995] • A concrete, focused, informal description of a single feature of the system used by a single actor. • Scenarios can have many different uses during the software lifecycle MSD Fall 2005
Types of Scenarios • As-is scenario: • Used in describing a current situation. Usually used during re-engineering. The user describes the system. • Visionary scenario: • Used to describe a future system. Usually described in greenfield engineering or reengineering. • Can often not be done by the user or developer alone. • Evaluation scenario: • User tasks against which the system is to be evaluated • Training scenario: • Step by step instructions designed to guide a novice user through a system MSD Fall 2005
Heuristics: How do I find Scenarios? • Ask yourself or the client the following questions: • What are the primary tasks that the system needs to perform? • What data will the actor create, store, change, remove or add in the system? • What external changes does the system need to know about? • What changes or events will the actor of the system need to be informed about? • To answer these questions, develop scenarios! MSD Fall 2005
Example: Accident Management System • What needs to be done to report a “Cat in a Tree” incident? • What do you need to do if a person reports “Warehouse on Fire?” • Who is involved in reporting an incident? • What does the system do if no police cars are available? If the police car has an accident on the way to the “cat in a tree” incident? • What do you need to do if the “Cat in the Tree” turns into a “Grandma has fallen from the Ladder”? • Can the system cope with a simultaneous incident report “Warehouse on Fire?” MSD Fall 2005
Scenario Example: Warehouse on Fire • Bob, driving down main street in his patrol car notices smoke coming out of a warehouse. His partner, Alice, activates the “Report Emergency” function from her FRIEND laptop. • Alice enters the address of the building, a brief description of its location (i.e., north west corner), and an emergency level. In addition to a fire unit, he requests several paramedic units on the scene given that area appear to be relatively busy. He confirms his input and waits for an acknowledgment. • John, the Dispatcher, is alerted to the emergency by a beep of his workstation. He reviews the information submitted by Alice and acknowledges the report. He creates allocates a fire unit and two paramedic units to the Incident site and sends their estimated arrival time (ETA) to Alice. • Alice received the acknowledgment and the ETA. MSD Fall 2005
Observations about Warehouse on Fire Scenario • Concrete scenario • Describes a single instance of reporting a fire incident. • Does not describe all possible situations in which a fire can be reported. • Participating actors • Bob, Alice and John • Next goal, after the scenarios are formulated: • Find the use case that specifies all possible instances of how to report a fire • What roles are the played by the participating actors? MSD Fall 2005
Use Case Example: ReportEmergency • The FieldOfficer activates the “Report Emergency” function of her terminal. FRIEND responds by presenting a form to the officer. • The FieldOfficer fills the form, by selecting the emergency level, type, location, and brief description of the situation. The FieldOfficer also describes possible responses to the emergency situation. Once the form is completed, the FieldOfficer submits the form, at which point, the Dispatcher is notified. • The Dispatcher reviews the submitted information and creates an Incident in the database by invoking the OpenIncident use case. The Dispatcher selects a response and acknowledges the emergency report. • The FieldOfficer receives the acknowledgment and the selected response. MSD Fall 2005
Use Case Example: ReportEmergency ctd • Use case name: ReportEmergency • Participating Actors: • Field Officer (Bob and Alice in the Scenario) • Dispatcher (John in the Scenario) • Exceptions: • The FieldOfficer is notified immediately if the connection between her terminal and the central is lost. • The Dispatcher is notified immediately if the connection between any logged in FieldOfficer and the central is lost. • Nonfunctional Requirements: • The FieldOfficer’s report is acknowledged within 30 seconds. The selected response arrives no later than 30 seconds after it is sent by the Dispatcher. MSD Fall 2005
Use Cases • A use case is a flow of events in the system, including interaction with actors • It is initiated by an actor • Each use case has a name • Each use case has a termination condition • Graphical Notation: An oval with the name of the use case • Use Case Model: The set of all use cases specifying the complete functionality of the system MSD Fall 2005
Use Case Associations • Relationship between use cases • Important types: • Consists of • Extends • Uses MSD Fall 2005
“Consists of” Association for Use Cases • Not explicitly named in UML • Problem: A function in the original problem statement is too complex to be solvable • Solution: Describe the function as the aggregation of a set of simpler functions. The associated use case is refined into smaller use cases • ManageIncident • CreateIncident • HandleIncident • CloseIncident MSD Fall 2005
“Extends” Association for Use Cases • Problem: The functionality in the original problem statement needs to be extended. • Solution: An extends association from a use case A to a use case B indicates that use case B is an extension of use case A. • That is, the use case “ReportEmergency” is complete by itself , but can be extended by the use case “Help” for a specific scenario in which the user requires help MSD Fall 2005
“Uses” Association for Use Cases • Problem: Need to reuse existing assets and resources • Solution: The uses association from a use case A to a use case B indicates that an instance of the use case A can perform all behavior described for the use case B • Example: The use case “ViewMap” describes behavior that can be used by use case “OpenIncident” MSD Fall 2005
How to Specify a Use Case • Actors (Description of Actors involved in use case) • Entry condition (This use case starts when...) • Flow of Events (Free form natural language text) • Exit condition (This use cases terminates when...) • Special Requirements MSD Fall 2005
Use Case Example: Allocate a Resource • Entry Condition • The use case starts after the Resource Allocator has selected an available Resource. • The Resource is currently not allocated • Flow of Events • The Resource Allocator selects an Emergency Incident. • The Resource is committed to the Emergency Incident. • Exit Condition • The use case terminates when the resource is committed. • The selected Resource is now unavailable to any other Emergency Incidents or Resource Requests. • Special Requirements • The Field Supervisor is responsible for managing the Resources MSD Fall 2005
Heuristics: How do I find use cases? • Select a narrow vertical slice of the system (i.e. one scenario) and discuss it in detail with the user to understand the user’s preferred style of interaction • Select a horizontal slice (i.e. many scenarios) to define the scope of the system. Discuss the scope with the user • Use mock-ups as visual support • Find out what the user does • Task observation (Good) • Questionnaires (Bad) MSD Fall 2005
Is there Life after Scenarios and Use Cases? • Functional Decomposition says yes • Every use case is refined into a set of lower level use cases • The use cases consists of lower level use cases • The use case is extended by another use case • This refinement is repeatedly done until the lowest level use cases are machine instructions that can be executed by the target machine MSD Fall 2005
Problems with Functional Decomposition • High cost of recompilation • Adding a new device usually requires compilation of every file that uses the device • Leads to unmaintenable code • The better way is to start with functional decomposition and then to find objects • Object identification • Sequence Diagrams MSD Fall 2005
Modeling a Briefcase BriefCase Capacity: Integer Weight: Integer Open() Close() Carry() MSD Fall 2005
A new Use Case for a Briefcase BriefCase Capacity: Integer Weight: Integer Open() Close() Carry() SitOnIt() MSD Fall 2005
Questions • Why did we model the thing as “Briefcase”? • Why did we not model it as a chair? • What do we do if the SitOnIt() operation is the most frequently used operation? • The briefcase is only used for sitting on it during video conferences. It is never opened nor closed. Is it a “Chair”or a “Briefcase”? • How can we live with our mistake? MSD Fall 2005
Summary • Requirements Engineering: • Greenfield Engineering, Reengineering, Interface Engineering • Scenarios: • Great way to establish communication with client • As-Is Scenarios, Visionary scenarios, Evaluation scenarios, Training scenarios • Use cases: Abstraction of scenarios • Pure functional decomposition is bad: • Leads to unmaintainable code • Starting with object identification is bad: • May lead to wrong objects, wrong attributes, wrong methods • The key to successful analysis: • Start with use cases and then find the participating objects • If somebody asks “What is this?”, do not answer right away. Return the question or observe: “What is it used for?” MSD Fall 2005
From Bernd Bruegge • CMU/Munich • Notes on Software Lifecycle MSD Fall 2005
Engineering Complex Systems • Based on modeling: A model of a system describes a specific aspect of the system under consideration. • Main principles used in developing models • Abstraction • Decomposition • Hierarchy • Encapsulation • Terminology • Notation: Language to express each model • Process: Guidelines for the orderly construction of the models (SEI Capability maturity model - Humphrey) • Product: A description of a model • Tool: Artifact that supports the building of models and enforces rules about the models (completeness, consistency, unambiguity) MSD Fall 2005
Hierarchy • Bring order into chunks (subsystems) obtained by abstraction and decomposition • Class (Object) identification • Attributes • Operations (Methods) • Define relations between classes • Called associations • 2 important hierarchies • "Part of" hierarchy • "Is-kind-of" hierarchy We will also deal with aspect hierarchies MSD Fall 2005
Other ways to deal with complexity • Start with an existing system • Use templates • Use techniques and tools • Build the system incrementally and iteratively • Use models • Use a Software development methodology • Software lifecycle MSD Fall 2005
Categories of software development methodologies • Object-oriented methodology • Systems are modeled as a collection of cooperating objects • Structured Methodology • Based on functional (algorithmic) decomposition • Data-driven Methodology • Structure of system is derived by mapping system inputs to outputs. • E,g, Jackson System Development • Aspect-oriented Methodology • Support for crosscutting abstractions • E.g. Demeter, AspectJ, HyperJ MSD Fall 2005
Models to Describe Systems • Greek Philosophers used two models to the universe: • Demokrit: Everything is composed of atoms • Heraklit: Everything flows (Panta Rhei: everything changes/moves) • A good software design methodology provides at least three models (Why not just two?): • Structural model: • What is the structure of the system? • What are the objects and how are they related? • Functional model: • What are the functions of the system? • How is data flowing through the system? • Control model • How does the system react to external events? • How is the event flow in the system ? MSD Fall 2005
Software Development Methodologies • Structured Analysis (Yourdon and DeMarco, 1978) • Structured Design (Yourdon and Constantine, 1979) • OMT (Rumbaugh et al, 1991) • Object-Oriented Modeling Technique • Object model: What are the objects in the system? • Functional model: What are the functions of the system? • Dynamic model: How does the system react to external events? • Other object-oriented methodologies: • HOOD (European Space Agency, 1989) • CRC (Class, Responsibility & Collaboration, Wirfs-Brock, 1991) • OOA (Yourdon &Coad, 1991) • Booch method (Booch, 1991) • OOSE (Jacobson, 1992) MSD Fall 2005
UML • UML (Grady Booch, Ivar Jacobsen and James Rumbaugh) • Structural Model: • Class Diagrams: Describes the structure of the system in terms of classes and objects • Functional Model: • Use Case Diagram: Describes the external behavior of the system from a functional point of view • Control Model: • Sequence Diagrams: Describes the dynamic interaction between objects identified in the structural model • Activity Diagrams: Describes the dynamic behavior of a single object MSD Fall 2005
CASE (Computer Aided Software Engineering) • Automate and aid a particular activity • Use information from one activity to another one. • OMTool (Rumbaugh, 1991): A front end CASE tool only for class diagrams • X-based, C++ templates (skeleton code), Suns, HPs and PCs • Lifecycle CASE tools have an underlying model of system development that spans many activities: (dated information: 1997) • OTE: Object Team Enterprise, Cayenne Software, for OMT • StP/OMT: Software through Pictures, Interactive Development Environments, CASE for many methodologies • Objectory: Object Factory, Objectory, CASE tool for OOSE • ROSE: Rational, Case tool for the UML methodology MSD Fall 2005
Methodology Definition • Methodology: A collection of techniques for building models - applied across the development of a software system (software life cycle) MSD Fall 2005
Software Life Cycle • Software development goes through a progression of states (software development activities) • Conception • Childhood • Adulthood • Retirement MSD Fall 2005
Examples of Software Development Activities (Pfleeger) Requirements Analysis: What is the problem? System Design:What is the solution? Program Design: What are the mechanisms that best implement the solution. Program Implementation: How is the solution constructed? Testing: Is the problem solved? Delivery: Can the customer use the solution? Maintenance: Are enhancements needed? Problem domain Implementation domain MSD Fall 2005
Software Lifecycle • Definition: • Set of activities that constitute a software project • Typical Lifecycle questions: • Which activities should I select for the software project? • What are the dependencies between activities? • How should I schedule the activities? MSD Fall 2005
Inherent Problems with Software Development • Requirements are constantly changing • The client does not know them in advance • Frequent changes are difficult to manage • Identifying checkpoints for planning and cost estimation is difficult • Phased Development • New system must be backward compatible with existing system • There must be a distinction between the system under development and the already released systems MSD Fall 2005
Life-Cycle Model: Variations on a Theme • Many models have been proposed to deal with the problems of defining activities and associating them with each other • The waterfall model • First described by Royce in 1970 • There seem to be at least as many versions as there are authorities - perhaps more MSD Fall 2005
The Waterfall Model of the Software Life Cycle Requirements Analysis and Definition System and Software Design System Testing Implementation and Unit Testing MSD Fall 2005
Problems with Waterfall Model • Managers love waterfall models: • Nice milestones • No need to look back (linear system) • Always one activity at a time • Easy to check progress during development: 90% coded, 20% tested • However, software development is iterative • While a design is being developed, problems with requirements are identified • While a program is being coded, design and requirement problems are found • While a program is tested, coding errors, design errors and requirement errors are found MSD Fall 2005