Transcript Document

Shanghai Jiao Tong University
Object Oriented Analysis and Design
Model Driven Development
上海交通大学软件工程中心
波音747
超过6百万个零件,仅机尾就有上百
个零件
能承载上百个旅客
能不停地飞行上千公里
Object Oriented Analysis and Design
2
波音747
 当波音在60年代开始生产747的时候,
一共画了75,000张工程图
为什么?
因为他们正在生产一个极其复杂的系统,
而且不能出哪怕是一点点的差错
Object Oriented Analysis and Design
3
软件开发也同样复杂
人与系统的交
互
系统安全
交易,存储
模型
可靠性,
可扩展性
子系统,模
块,分布式
Object Oriented Analysis and Design
成千上万行程序
4
什么是模型
Object Oriented Analysis and Design
5
什么是模型驱动开发?
Model-driven Development (MDD) is a challenging
approach to software engineering that is expected to
change the way systems are developed. It postulates
the model as the main artifact being developed rather
than the code.
Object Oriented Analysis and Design
6
模型驱动开发
A strategic initiative to automate the integration, generation,
modernization, visualization, and reuse of software artifacts
 Unify business
and software teams
with model-driven
business integration
Modeling
Web Requirements
and Application Data
Business
Processes
Software
Construction
 Improve productivity by
providing a choice of
modeling paradigms
 Make reuse practical
with asset-based
development
Object Oriented Analysis and Design
Management
7
Deployment
模型驱动开发成熟度方阵
Smaller Semantic Gap
Object Oriented Analysis and Design
8
Level 0: Manual
package com.megabank.loan;
import javax.ejb.EntityBean;
public abstract class LoanBean implements EntityBean {
private javax.ejb.EntityContext entityContext;
public LoanBean() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
public void ejbLoad() {}
public void ejbStore() {}
public javax.ejb.EntityContext getEntityContext() {
return entityContext;
}
public void setEntityContext(javax.ejb.EntityContext
entityContext) {
this.entityContext = entityContext;
}
public void unsetEntityContext() {}
public abstract void setRate(java.lang.Float rate);
public abstract java.lang.Float getRate();
public abstract void setAmount(java.lang.Float amount);
public abstract java.lang.Float getAmount();
public abstract void setBalance(java.lang.Float balance);
public abstract java.lang.Float getBalance();
public abstract void setTermMonths(java.lang.Integer
termMonths);
public abstract java.lang.Integer getTermMonths();
public java.lang.String ejbCreate() throws
javax.ejb.CreateException {
return null;
}
public void ejbPostCreate() {}
public abstract void setId(java.lang.Long aId);
public abstract java.lang.Long getId();
…
}
Object Oriented Analysis and Design
9
Level 1: Visualization
 通常是由代码逆
向产生模型图
 目的
文档化
浏览
理解
Object Oriented Analysis and Design
10
Level 2: Synchronization
 模型和代码保持
同步
自动
手工
 修改模型或代码
Object Oriented Analysis and Design
11
Level 3: Patterns And Code Templates
 “A pattern provides a
common solution to a problem
in a specific context” (Grady
Booch)
 非常容易的重用成功验证的
设计
 各种pattern包括
 GoF Patterns
 IBM e-business patterns
 Sun’s J2EE patterns
 Code template允许代码级的
重用
Object Oriented Analysis and Design
12
Level 4: Platform Independence
PIM 不会因为技术或程序语言
等的变化而受到影响
Refinement
Transformations
PIM 可以用来产生各种平台的
解决方案
Platform-Specific Model
Platform-Specific Model
Platform-Specific Model A
Transformations
improve adoption of new platform
technology
Object Oriented Analysis and Design
PlatformIndependent
Model
13
Level 5: Executable Models
 模型本身可以执
行
 用户基本上面对
的是模型
Object Oriented Analysis and Design
14
Level 6: MDD Vision
Requirements, Use Cases
Systems and Business Engineering
Patterns and traceability
Design
Test and
Instrumentation
Customizable
transformations
Code
Debugging
Build and Deploy
Object Oriented Analysis and Design
15
Application
Level 6 Future Possibilities
 模型驱动排错
例如断点设在模型
上而不是在代码上
 可视化运行时分析
例如线程等
Object Oriented Analysis and Design
16