对于软件工程来说,最重要的是过程(process)
系统由三部分组成:
成分:Entities. Basic elements or constituents. relationships among abjects
环境:系统之外的东西
边界:划分环境与系统的边界线
sub-systems: Interactions between subsystems are called interfaces.
对象:独立的,可标记的项目,单元或实例,
类:对象的集合,集合内的对象拥有相同的结构,相似的属性,相同的行为,相似的关系,相同的语义。
(发现翻译成中文后好艰涩难懂)
UML DIagrams
Use case diagram
Class diagram
Interaction diagram
- sequence diagram
- communication diagram
- timing diagram
Behavior diagram
- state machine
- activity diagram
Implementation diagram
- component diagram
- deployment diagram
Use case modelling
Actors
- An actor in a use case is an external agent that uses or interacts with the system
- There is one one initiator actor and possibly other participating actors
- An actor can be a user or a role, such as a person or an external system
- It can also be a characteristic of the environmental, such as time ortemperature change
Scenarios and Use Cases
- A scenario is a behaviorally related sequence of steps, automated or manual, for the purpose of completing a business task
- A use case is a collection of related scenarios, including normal and alternative scenarios
- Not directly related to object technology
Temporal Event Use Cases
- A temporal event is a system event that is triggered by time
- The actor of a temporal event use case is time
Use Case Example
- Put an elephant into the refrigerator
- Put a giraffe into the refrigerator
Use Case Diagrm
We learn from mistakes
- An analysis use case model should be device independent
- An analysis use case is not an object
- It is all right to have an initiating actor and a participating actor
Object Modelling
- Object modelling is a technique for identifying classes within the systems environment and the relationships among these classes
- Should be implementation independent
- Class diagrams versus object diagrams (which are instance diagrams)
- Object modelling invoves:
- A study of existing classes to see if they can be reused or adapted for new uses
- Defining new or modified classes that will be combined with existing ones into a useful computing application
Class Diagrams
- A link is a physical or conceptual relationship between 2 or more objects
- An association describes a group of links with common structure and common semantics
- A link is an instance of an association
Multiplicities
- The multiplicities between classes X and Y refers to the number of instances of X that will be present for a given instance of Y, and vice versa.
- Multiplicities are commonly referred to as 1:1, 1:M, M:1, M:M relationships
- Also known as, cardinality constraints
We learn from mistakes
Sample UML Multiplicity Notations
Aggregations
- Aggregation is a kind of association
- Aggregations are also known as "is-part-of" relationships
- Composition versus aggregation
Example of Composition
Example of (Shared) Aggregation
What are differences between aggregation, composition and dependency
Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist.
Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child). Rooms don't exist separate to a House.
The above two are forms of containment (hence the parent-child relationships).
Dependency is a weaker form of relationship and in code terms indicates that a class uses another by parameter or return type.
Dependency is a form of association.
Inheritance
Message
- A message is passed when one object invokes one or more of another object's operations to request information or some action
- It is not a persistent relationship and not included in class diagrams.
Identify Actors and Use Cases
Construct Use Case Diagram
- A use case diagram graphically depicts the system scope and boundaries
- It represents the relationships between actors and use cases
- The partitioning of system behavior into subsystems is important in defining the development strategy:Which use cases will be developed first and by whom
Document Use Case Normal Course of Events
- The normal course of events is a step-by-step description starting with the actor initiating the use case until the end of the business events
- For each use case identified, document its normal course of events
Use Case Relationships
- Instances of the actor and instances of the use case communicate with each other
- The only relationship between actors and use cases
- An include relationship from use case A to use case B indicates that an instance of A will also contain the behavior as specified by B
- An extend relationship from use case B to use case A indicates that an instance of A may be augmented (subject to specific conditions specified in the extension) by the behavior specified by B