identify and
document what is required
overview
customers
goals
system functions
system attributes
Use cases expressed in a way that does not imply an implementation.
Basic problem
solving approach
"chop up into more manageable chunks"
Structured analysis : "chunks" are tasks
Object oriented : "chunks" are concepts or objects
"real world" things
not software components
cashier, sale |
Yes |
window, database |
No |
have attributes, but no operations
(chapter 9)
Category |
Examples |
---|---|
physical object |
POST, Plane |
specifications, descriptions |
ProductSpecification |
places |
Store, Airport |
transactions |
Sale, Reservation |
transaction line item |
SalesLineItem |
roles |
Cashier, Pilot |
containers |
Store, Bin, Plane |
items in a container |
Item, Passenger |
other systems |
AirTrafficControl |
abstract concepts |
Hunger, Claustrophobia |
organisations |
SalesDepartment |
events |
Sale,
Meeting, |
processes ?? |
GivingARefund |
rules and policies |
RefundPolicy |
catalogues |
ProductCatalogue |
records |
Receipt |
financial instruments |
LineOfCredit |
manuals |
RepairManual |
"Read the specifications documents and underline the nouns or noun phrases"
Recommended in most texts. Simple and obvious. Meyer says "no". (OOSC, ch 22) Only finds concepts so obvious that you would have found them anyway. Doesn't help in finding non-obvious but important concepts.
POST |
Item |
Store |
Sale |
Payment |
ProductCatalog |
ProductSpecification |
SalesLineItem |
Cashier |
Customer |
Manager |
|
Conceptual model
(concepts only)
description of item different from item
maybe no items, but still description
(chapter 10)
relationships between concepts
connection must be of interest
needs to be preserved for some duration
Associations are
for analysis phase
may be implemented (as reference to object) but
not necessarily.
Records-current is
name of association
use verb phrase
Multiplicity
Category |
Examples |
---|---|
A is a physical part of B |
Drawer
- POST |
A is a logical part of B |
SalesLineItem
- Sale |
A is physically contained in B |
Item
- Shelf |
A is logically contained in B |
ItemDescription
- Catalogue |
A is a description of B |
ItemDescription - Item |
A is a line item of a transaction or report B |
SalesLineItem - Sale |
A is recorded in B |
Sale - POST |
A is a member of B |
Cashier
- Store |
A is an organizational subunit of B |
Department - Store |
A uses or manages B |
Cashier
- Store |
A communicates with B |
Customer
- Cashier |
Category |
Examples |
B is a transaction and A is related to B |
Customer
- Payment |
A & B is are transactions and A is related to B |
Payment
- Sale |
A is next to B |
POST
- POST |
A is owned by B |
POST
- Store |
A is a physical or logical part of B
A is physically or logically contained in B
A is recorded in B
Category |
Examples |
A is a physical part of B |
not applicable |
A is a logical part of B |
SalesLineItem - Sale |
A is physically contained in B |
POST
- Store |
A is logically contained in B |
ProductSpecification
- |
A is a description of B |
ProductSpecification - Item |
A is a line item of a transaction or report B |
SalesLineItem - Sale |
A is recorded in B |
(current)
Sale - POST |
A is a member of B |
Cashier - Store |
A is an organizational subunit of B |
not applicable |
A uses or manages B |
Cashier
- POST |
A communicates with B |
Customer - Cashier |
B is a transaction and A is related to B |
Customer
- Payment |
A & B is are transactions and A is related to B |
Payment - Sale |
A is next to B |
POST - POST ? |
A is owned by B |
POST - Store |
(no attributes)
(Larman, fig 10.7)
Two criteria, "need to know" and "comprehension"
If don't need to know something, don't
put it in.
According to specifications, we don't need to know that a sale was associated with a customer.
If specifications were different, there may be a need to know that sale is associated with customer.
eg build up
customer profile
put weetbix beside fruit; cornflakes beside
sweets
mailing list for advertising of weetbix promotions
need to know is linked to specifications |
Conceptual model is a document. Should give understanding of domain.
The more complete, the better understanding it gives to reader. Also the more useful it is for the next application, or for extensions to this one.
But, the more complete, the more we have to omit when we implement.
Best balance is
somewhere in middle.
all need-to-know associations
+ give
essential understanding of domain.
Analysis is about
understanding the problem domain |
Suppose we have written a function to find the greatest common divisor of two integers.
gcd(6,9) = 3
But what happens if we use letters as the arguments.
gcd('b','v') = ?
In a strongly-typed language such as Pascal, Eiffel, Java you get a syntax error. (Signature is)
int gcd(int a, int b) // Java gcd(INTEGER a, b) : INTEGER -- Eiffel
In a weakly-typed
language (pre-Anscii C or
Fortran 77), you get
gcd('b','v') = 7
In an untyped language
Prolog:
?gcd(b, v, Z) NO
Scheme and Smalltalk:
execution error
gcd is only defined on integers.
It does not make sense to ask for the gcd of two characters. (Some languages would be happy to find the gcd of a string and a record).
gcd: N X N -> N
Programmers have spelled out their intentions.
The relevant domains are clear to the human reader.
The compiler finds a class of errors
for you.
(Static typing)
The compiler has more information and can generate more efficient code.
Strictly speaking not an OO concept
Language
asides:
C++ : Generics is an add-on, called templates.
Java :
No generics, relies on casting.
Generics is most useful in "collection" classes such as Stack, LinkedList, Queue, Array, ...
Eiffel |
Java |
---|---|
str: String c: Character s: STACK[STRING] s.put("abc" str:= s.item |
String str; Character c; Stack s; s.push("abc"); str = (String) s.peek(); |
The
(String) in str = (String) s.peek();is an example of casting. It tells the compiler that what is coming from the top of the stack is a Sting object.
Eiffel: c := s.item
syntax
error
Java: c = (Character) s.peek();
execution
error
Example: Read strings from keyboard and prints in reverse
order, Java (no generics) needs to catch a ClassCastException
import java.io.*; import java.util.*; /** Reads strings and prints last string first etc */ public class Reverse { public static void main (String [] args) throws ClassCastException { String line; BufferedReader keyboard; keyboard = new BufferedReader(new InputStreamReader(System.in)); Stack s; s = new Stack(); line = keyboard.readLine(); while (line.length() > 0) { s.push(line); line = keyboard.readLine(); } while ( !s.empty()) { line = (String) (s.peek()); System.out.println(line); s.pop(); } } } // main
Eiffel would not need this.