john m. artim, ©2003. permission to copy, modify, or distribute is granted. use cases and software...

39
from the notebooks John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Upload: scott-morton

Post on 26-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

from the notebooks of John Artim

John M. Artim, ©2003. Permission to copy, modify, or distribute is granted.

Use Cases and Software Requirements Specification

Concept Modeling

Page 2: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

2from the notebooks of John Artim

The Use Cases and Software Specification Series

• The notebooks in this series introduce the basics of software specification using object technology.– Use Cases describe functional requirements.

– Objects summarize content of functional requirements.

• Also introduced are techniques for describing and working with business processes and user interface requirements and specifications.

Page 3: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

3from the notebooks of John Artim

Notebooks in the Use Cases and Software Specification Series

• Use Case BasicsIntroduces functional specification through use case methods.

• Concept Modeling for Analysis and SpecificationProvides an object-oriented approach to analyzing use case scenario

content and documenting this analysis in specifications.

• Use Case Pragmatics for Functional SpecificationDiscusses pragmatic issues in authoring, reviewing, and managing use case

models used in functional specification.

• Use Case Authoring and User InterfaceIntroduces techniques for analyzing and specifying user interface

requirements as a part of use case authoring.

• Business Process ModelingIntroduces techniques employing Use Case models and Activity diagrams

to analyze and depict business processes.

Page 4: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

4from the notebooks of John Artim

Goals of this Notebook

• This notebook discusses concept modeling in support of requirements specification.

• This includes an introduction to object and state modeling using UML notation.

Browsing Time for this notebook is about 2 hours.

Page 5: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

5from the notebooks of John Artim

Acknowledgements

Feel free to use this material, in whole or part, for your own training needs, though acknowledgements of and links to www.primaryview.org are greatly appreciated!

A Microsoft® PowerPoint file of this notebook is available by request. Send an email to John Artim ([email protected]) requesting the Use Case Concept Modeling Notebook PowerPoint file in the Use Cases and Software Requirements Specification series. Please include your name, affiliation, and your intended use of the material.

Page 6: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

6from the notebooks of John Artim

Background for this Notebook

• You should have a basic understanding of use case modeling such as is outlined in the Use Case Basics notebook in the Use Cases and Software Requirements Specification series.

Page 7: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

7from the notebooks of John Artim

Major Topics in this Notebook

• What is a Concept Model and what is it good for?

• How are concepts described with an Object Model?

• How are concepts with a strong state character described?

Page 8: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

8from the notebooks of John Artim

Why Concept Modeling?

• Concept modeling, as an adjunct to use case modeling, helps to maintain unambiguous language with scenarios.– The concepts (read for this, the language) in

the scenarios of a use case model must be used consistently.

• Any inconsistency means that the requirements are inconsistently expressed.

• This will lead to an unpredictable implementation.

Page 9: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

9from the notebooks of John Artim

Concept Modeling

• In simplest form a concept model is simply a glossary of the terms used in scenarios.– The glossary is used to promote consistent usage of

terms throughout all scenarios.

• A concept model can also be an object model.– The purpose is still the same—consistent use of

language in scenarios.– An object model extends the notion of glossary by

structuring the concept definitions.– This structure highlights ambiguity, duplication, and

inter-relationships among concepts.

Page 10: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

10from the notebooks of John Artim

Concept Modeling Basics

• At a minimum each concept must have its own definition where:– Each concept has one and only one preferred term—

avoid multiple synonyms in your scenarios!

– Overlapping concepts are defined by using one concept’s preferred term within the second concept’s definition.

– All significant terms used in use case scenarios should be included in this glossary (concept model).

Page 11: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

11from the notebooks of John Artim

Example Glossary—Catalog Sales

• Address—A physical location identified by a street name, number, city name, state or province name, country name, and postal code.

• Catalog—A set of one or more catalog items organized around some marketing theme.

• Catalog Item—A listing within a catalog representing a single product.• Customer—A person who receives goods or services on a for-fee basis.• Order—A set of one or more order items requested by a customer for

purchase and shipment to some address.• Order Item—A single item within an order representing a customer

request to purchase a quantity of one catalog item.• Product—An item for sale fulfilling some customer need and identified

by a SKU number.

Page 12: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

12from the notebooks of John Artim

Glossary Pros and Cons

• Pros– Easy to learn to

author.– Easy to construct.– Easy to share with

subject matter experts (SMEs).

– Nothing more sophisticated than a text editor (and a good dictionary!) is needed.

• Cons– Hard to maintain

without unnecessary overlap or inconsistency.

– Hard to automatically check scenario language against a glossary (possible with scripting).

– Not always expressive enough.

Page 13: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

13from the notebooks of John Artim

If a Glossary is not Enough?

• If you are:– Working in a large domain?– Working with other analysts?– Sharing a common reference implementation

or model?

• Consider adding more structure to your concept definitions using an object model.

Page 14: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

14from the notebooks of John Artim

Concept Modeling with Object Models

• Each concept is represented by a class.• The properties of each concept are represented by

attributes.• The relationships between concepts are represented by

different types of association:– Basic associations represent a concept where one concept definition

references another concept.– Aggregation associations represent a whole-part relationship between

two concepts.– Inheritance associations represent a type-of relationship between two

concepts.

• Key behaviors of the concept are defined as responsibilities.

Page 15: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

15from the notebooks of John Artim

What is a Class?

• Technically, a class is an encapsulated package of state and function.

• For our purposes as analysts, a class is a way to define a concept that:– Separates the part of the concept that is distinct and

individual from the parts that are defined in other concepts.

– Allows a rich set of relationships among concepts to be defined.

– And is maintainable!

Page 16: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

16from the notebooks of John Artim

Class Descriptions

• A class is defined by:– An operational definition.– A list of attributes of the class.– A list of responsibilities of the class.– A list of associations the class has to other

classes.• Basic associations• Aggregations (whole-part relationships)• Inheritance associations (type-of relationships)

Page 17: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

17from the notebooks of John Artim

Separation of Concepts

• The core of a concept is defined by:– An operational definition.– A list of attributes of the class.– A list of responsibilities of the class.

• The relationship of one concept to other concepts is defined by:– The associations the class has to other classes.

Page 18: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

18from the notebooks of John Artim

Attribute

• An attribute represents a property of a concept.– Names, quantities, size, weight, color, shape

• Typically (but not necessarily!), an attribute is expressed some primitive data type.

• And associations represent ties to other classes (concepts).

• But this is a modeling style issue best resolved by corporate analysis guidelines and sometimes best resolved on a case-by-case basis.

Page 19: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

19from the notebooks of John Artim

Responsibility

• A responsibility represents a bundle of function the class (concept) must be able to perform as a part of what defines it.– A payment can debit itself.– An address can validate itself.– An order item can confirm sufficient stock is

available.– An order can confirm itself.

• Which might lead to order items confirming stock available and to a payment debiting itself.

Page 20: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

20from the notebooks of John Artim

Association

• An association represents some way in which one concept is defined, in part, by another concept.

• The connection or relation of ideas, feelings, sensations, etc.; correlation of elements of perception, reasoning, or the like—Random House Unabridged Dictionary, © 1996.

Page 21: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

21from the notebooks of John Artim

Example of an Association

• An Order is defined, in part, by:– The order items that it contains.– The customer who is ordering it.– The payment that the order requires.– The employees who have helped fulfill it.– The address to which the order items are

shipped.

Page 22: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

22from the notebooks of John Artim

Association Types

• Generic Association

• Aggregation– Also called a composition or whole-part

relationship

• Inheritance

Page 23: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

23from the notebooks of John Artim

Generic Association

• A generic association is a connection between two (or more) concepts that indicates that they collaborate to create a greater concept.– The association can be named to give life to the

association itself.

– Or the role one or both classes at the end of the association can be named.

• All other association types are specializations of this generic type.

Page 24: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

24from the notebooks of John Artim

Aggregation or Whole-Part

• This is the relationship of a class (or concept) representing a whole to the classes (concepts) representing the parts.

• For example, and Order is a whole and Order Item is a part of that whole.

Page 25: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

25from the notebooks of John Artim

Inheritance

• An inheritance association shows where one class represents a generic concept and other classes represent specific concepts that are based on the generic.

• For example, – The concept Payment represents a generic way to pay for goods

or services.– The concept Credit Charge represents a Payment by credit card.– And the concept Purchase Order represents a Payment by

Purchase Order.

• This allows us to describe the common part of the concept of Payment separately from the specifics of each kind of Payment.

Page 26: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

26from the notebooks of John Artim

Example of a Class Definition—Order

• Brief Description– A set of one or more order

items requested by a customer for purchase and shipment to some address.

• Attributes– Order ID (a string)

• Responsibilities– Confirm

• Whole-Part Relationships– The Order Items that it

contains.

• Associations– The Customer who is

ordering it.

– The Payment that the Order requires.

– The Employee who took the Order.

– The Employees who have helped fulfill it.

– The Address to which the Order Items are shipped.

Page 27: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

27from the notebooks of John Artim

Example of a Responsibility Definition—Confirm

• Each Attribute, Responsibility, Association, and so on, must similarly be defined as appropriate for that item.

• Confirm– The action of confirming completion of an

Order. This includes:• Confirming each Order Item

• Process the Payment

Page 28: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

28from the notebooks of John Artim

Example—Customer Service Class Diagram

Page 29: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

29from the notebooks of John Artim

Pros and Cons of Class Modeling

• Pros– Can see an overview

of the entire glossary.• In a diagram or two.

– Can get tool support for maintaining consistency between classes and scenarios.

– Easier to maintain.• Each class points to

other classes that are affected by changes.

• Cons– Tool costs higher.

• Unless you use Visio, but then you have more work to do!

– Harder to learn to do.• But not that hard!

– Initial authoring costs higher.

• But maintenance costs lower.

Page 30: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

30from the notebooks of John Artim

State Modeling

• State modeling helps to simplify talking about classes which exhibit states.

• These are often concepts that are operated on by a cascade of business processes where each process transforms the object from one state to the next.

• This can be most helpful where there are branching choice points where one state can lead to a choice of two or more states depending on what happens in the business processes.– This shows up in the coming example.

Page 31: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

31from the notebooks of John Artim

State Defined

• State generally can be thought of as the encapsulated data of a class (concept).

• A state model represents a class’s encapsulated data as a discrete series of states where each state leads to one or more other states.

Page 32: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

32from the notebooks of John Artim

Order Object—State Characteristics

• For some concepts, the behavior of the concept is dominated by the set of states it can be in.

• The Order class displays state characteristics and can be in these states:– New– Order-in-Progress– Picking-and-Packing– In-Transit– Delivered– Closed

• Note: the set of states to choose is dependent on the business processes supported—be careful!

Page 33: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

33from the notebooks of John Artim

Order—State Transition Diagram

Page 34: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

34from the notebooks of John Artim

Initial State

• The Initial State is a standard state that indicates the entry state for a class.

• All state models must start with a single initial state!

Page 35: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

35from the notebooks of John Artim

State

• Each state in a State diagram is represented by an oval with the name of the state inside the oval.

Page 36: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

36from the notebooks of John Artim

Final State

• The Final State is a standard state that indicates the exit state for a class.

Page 37: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

37from the notebooks of John Artim

State Transition

• To be valid, each state must have at least one transition leading into it, and at least one transition leading out of it.

• A state transition arc is a line with an arrowhead at one end that symbolizes a transition from one state (at the tail of the arc) to another state (at the head).

Page 38: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

38from the notebooks of John Artim

Why Use State Modeling?

• A class exhibits a fixed number of states and transitions, and the state of the class is important to one or more Actors.– If the number of states or transitions vary, state modeling

isn’t appropriate.– Is there at least one actor who sees the state of this class

in at least one use case?

• If a state model seems too complex, does the state model make it easier?– For the author to understand the state-based class?– For the reader?

Page 39: John M. Artim, ©2003. Permission to copy, modify, or distribute is granted. Use Cases and Software Requirements Specification Concept Modeling

Concept Modeling in SpecificationDecember 2003

39from the notebooks of John Artim

Conclusions

• Concept Modeling in some form helps drive consistent scenarios.– This leads to cleaner requirements.

• Glossaries are cheap and easy way to get a good chunk of this consistency.

• To get good consistency for large domains or when sharing work among many analysts class models are a better tool.

• State diagrams provide an easy way to visualize concepts that are defined in part by their state behavior.