Document 13512529

advertisement
software
studio
object models:
classification
Daniel Jackson
1
atoms (aka objects)
atoms are
› distinguishable: have an identity
› immutable: don’t change
› indivisible: not structured
consequences
› don’t need to model ids explicitly
› change & structure expressed in sets & relations
2
basic sets
› box represents set of atoms
› set may be infinite, empty, singleton
Shape
Element
URL
Theorem
Patient
Language
Color
Class
Page
Proof
Prescription
Functional
Language
Dimensions
Id
Domain
Refutation
Treatment
Haskell
3
classification
› shared arrow: disjoint subsets
Element
Shape
Rectangle
Oval
Square
Circle
Block
Div
Inline
Table
Span
Language
FSObject
File
Anchor
Directory
Link
Soft
Hard
Functional
Language
Imperative
Language
Haskell
Pascal
4
dynamic sets
contents change
› as objects are born & die
› move between sets
FSObject
File
Directory
Message
Read
Phone
Unread
Onhook
Offhook
5
exhaustion
› abstract set: exhausted by subsets
› indicated by italicizing name
Message
Read
Phone
Unread
Onhook
Offhook
FSObject
Shape
Rectangle
Oval
Square
Circle
File
Directory
Link
Soft
Hard
6
multiple classifications
› separate subtrees not mutually disjoint
Mobile
Language
Typed
Phone
Landline
Onhook
Offhook
Functional
Language
Imperative
Language
Statically
Typed
Dynamically
Typed
7
designations
meaning of set
› should be clear
› if not, write ‘designation’
L in StaticallyTyped: in a program written in language L, type errors are caught at compile time; need not imply that types are declared
P in OnHook: phone P is not engaged in a call
8
syntax summary
B
A
A ⊆B
B
A1
B
A2
A1 ⊆B, A2 ⊆B
A1 ∩ A2 = ∅
A1
A2
A1 ⊆B, A2 ⊆B
A1 ∩ A2 = ∅
A1 ∪ A2 = B
9
common mistakes
#1. bad sets
ill-defined: Weather
collections: Set
singletons: Page (in a model of a webpage)
#2. using subset for relationship role
Friend
#3. reading subset as is-a
Lassie is-a Dog
Dog is-a Species
Member
Friend
#2: friend should
be a relation
Species
Dog
Lassie
#3: Dog means two
different things!
10
MIT OpenCourseWare
http://ocw.mit.edu
6.170 Software Studio
Spring 2013
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Download