Software Modelling
2016-10-29 12:20:19 0 举报
AI智能生成
软件建模是一种用于描述、理解和设计复杂软件系统的技术。它涉及到使用各种符号和图表来表示软件的各个组成部分及其之间的关系。通过软件建模,开发人员可以更好地理解系统的结构、功能和行为,从而提高软件开发的效率和质量。常见的软件建模方法包括结构化分析与设计(SA&D)、面向对象分析和设计(OOAD)以及统一建模语言(UML)等。这些方法可以帮助开发人员在项目开始阶段就明确需求、制定计划并预测潜在问题,从而降低项目风险。总之,软件建模是软件开发过程中不可或缺的一环,它有助于提高开发效率、保证软件质量和满足用户需求。
作者其他创作
大纲/内容
SMD
State Machine Diagram
Objective
Elements
State
condition of the object at a moment in time.
Transition
directed relationship between two states such that an event can cause the object to change from the prior state to the subsequent state.
Event
a significant or noteworthy occurrence.
Class Diagrams(design model)
keywords
<<interface>>
{abstract}
Activity Diagram
shows sequential and parallel activities in a process
GRASP Pattern
Creator
Problem
Who should be responsible for creating a new instance of some class?
Solution
High cohesion
Responsibilities grouped within a single class should be strongly (functionally) correlated(but correlated functionalities are not necessarily encapsulated in a single class)
Indirection
Assign the responsibility to an intermediate object to mediate between the other components or services so that they are not directly coupled.
Information expert
What is a general principle of assigning responsibilities to objects?
Assign a responsibility to an information expert class such that it has the information to fulfill this responsibilities
Low coupling
encourages minimising dependency on other elements so as to reduce the impact of change
f
Polymorphism
How to handle alternatives based on type? How to create pluggable software components?
Assign responsibilities for behavior[define specific behavior based on types(classes). ] using polymorphism to the types for which the behavior varies when variation occurs.
Use operation with the same interface (giving a single interface to entities of different types)
Controller
What first object beyond the UI layer receives and coordinates (\"controls\") a system operation?
Facade Controller
Use case or Session Controller
Protected variations
Protects elements from undesirable impact caused by the variations of other elements
e.g. Restful API
More related Principles
The Liskov Substitution Principle (LSP)
Open-Closed Principle (OCP)
Identify points of predicted variation or instability; assign responsibilities to create a stable interface around them.
Pure fabrication
Fabricate an object with responsibilities assigned to dealing with special cases that couldn't be solved by HCo && LCp
e.g. DAO layer(XXXRespository/XXXService) abstract classes in MVC framework (accommodate different transactions for different databases)
Domain Model(analysis model)
Procedure
1. Requirements (Use case Model)
2. Business Modelling (Domain Model)
3. Design (Design Model)
Features
Conceptual classes only
No Software Artifacts/Classes
OO Modelling: Reducing the Representation Gap
Attributes vs. Classes
Relationship
Aggregation
Composition
illustrates noteworthy concepts in a domain
act as a source of inspiration for designing some software objects and will be an input to other artifacts
a visualization of things in a real-situation domain of interest
Architecture
Layer and Tier
Logical layers are merely a way of organizing your code.
What is Layer
Why Layering
Address changes rippling through system due to coupling
Address intertwining of application logic and UI reducing reuse and restricting distribution options
Address high-coupling of area of concern impacting division of development work
Unified Process
Design Model
Sequence Diagram
Communication Diagram
Use Case Model
Use Case Text
Operation Contracts
Domain Model
What is
An iterative process providing a structure on how to introduce and implement OOA/D
Architectural Pattern
MVC
Distributed Architecture
Hosted on different platforms
Communicate through a network
Client-Server Architecture
Peer to Peer Architecture
Roles of client and server switch back and forth between components
Pipeline Architecture
PAC
MVP
MVVM
React is a typical example of MVVM
Software Concept
Generalizaion
Generalization is the activity of identifying commonality among concepts and defining super class (general concept) and subclass (specialized concept) relationships. It is a way to construct taxonomic(分类学的) classifications among concepts that are then illustrated in class hierarchies.
Patterns
Observer (Publish-Subscribe)
Different kinds of subscribers want to react in various ways when they receive messages.
The publisher wants to maintain low coupling to subscribers.
Define an observer interface. And we have one subject class(Observable) +one observer class
The publisher can DYNAMICALLY REGISTER subscribers who are interested in an event and NOTIFY them when an event occurs.
ADV
Behavioral
Strategy
How to design for the ability to change these algorithms or policies?
Singleton
When only one instance is allowed. Objects need a global and single point of access.
Define a static method of the class that returns the singleton.
DSV
May want subclasses: static methods are not polymorphic (virtual); no overriding in most languages
Most remote communication mechanisms (e.g. Java's RMI) don't support remote-enabling of static methods.
A class is not always a singleton in all application contexts.
Creational
Facade
Too many interfaces/classes/methods in the subsystem making it hard to use.
Define a single point of contact to the subsystem—a facade object that wraps the subsystem and make it easy to use.
Structural
Factory
Create a Pure Fabrication object called a Factory that handles the creation.
Separate responsibility of complex creation into cohesive helper objects.
Hide potentially complex creation logic.
Use
Adapter
Structional
Composite
How to treat a group or a composition structure of objects the same way (polymorphically) as a non-composite (atomic) object?
Define classes for composite and atomic objects so that they implement the same interface.
Developing Model
Common steps could be mixed in any step of Waterfall or Agile development
Waterfall
Agile
Responsibility-Driven Design
RDD leads to viewing an OO design as a community of collaborating responsible objects.
Data/Event-Driven Design
Test-Driven Development and Refactoring
The unit tests actually get written (prevent programmers from naturally avoiding writing tests)
It makes the developer focus on the requirements before writing the code.
Clarification of detailed interface and behaviour
The confidence to change things
Operation Contract
Four Key Concepts
Operation
Name of operation and parameters
Cross References
Use cases within which this operation can occur
Preconditions
Noteworthy assumptions about system state or objects in the Domain Model before execution of the operation.
Postconditions(Results)
Most important section. State of objects in the Domain Model after completion of the operation.
Define system operations.
Create contracts for system operations.
Use Case Diagram(behavioral diagrams)
Draw
System under Discussion
Actor
supporting
provides a service (e.g. information) to the SuD (e.g. an automated payment authorization service).
primary
has user goals fulfilled through using services of the SuD (e.g. the cashier).
offstage
Scenario(or use case instance)
a specific sequence of actions and interactions between actors and the SuD.
Use case
a collection of related success and failure scenarios that describe an actor using the SuD to support a goal.
Include Use Case
Extend Use Case
e.g. payment is <<included>> in normal use case but <<pay with credit card>> is an extended use case
Conditional Use case
Describe how external actors interact with the software system
input events to SSDs and we can see what the results are
Interaction Diagram(design model)
System Sequence Diagram
an abstraction that ignores all presentation and medium
All systems are treated as a black box
Design Sequence Diagram
the return line is optional if nothing is returned
synchronous procedure use black triangle with solid line
asynchronous procedure use arrow with dashed line
Comparison
Sd
Clearly shows time ordering of messages
Can more easily convey the detail of message protocols between objects
Space Consuming
Linear Layout can obscure relationships
Cd
Clearly shows relationships between object instances
More difficult to see message sequencing
Identify input and output system events.
the emphasis of the diagram is events that cross the system boundary from actors to systems.
Used for Dynamic Object Modeling
0 条评论
回复 删除
下一页