MDA: Model Driven Architecture 荆玲MF0933014. Summary 1. Introduction 2. MDA Overview 3....

34
MDA: Model Driven MDA: Model Driven Architecture Architecture 荆荆 荆荆 MF0933014 MF0933014

Transcript of MDA: Model Driven Architecture 荆玲MF0933014. Summary 1. Introduction 2. MDA Overview 3....

Page 1: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

MDA: Model Driven MDA: Model Driven Architecture Architecture

荆玲荆玲MF0933014MF0933014

Page 2: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

SummarySummary

1. Introduction1. Introduction 2. MDA Overview2. MDA Overview 3. Developing in MDA3. Developing in MDA 4. Pros vs. Cons4. Pros vs. Cons

Page 3: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

1. Introduction1. Introduction

Page 4: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

A heterogeneous world…A heterogeneous world…

Programming languages:Programming languages: ~3 million COBOL Programmers~3 million COBOL Programmers ~1.6 million VB Programmers~1.6 million VB Programmers ~1.1 million C/C++ Programmers~1.1 million C/C++ Programmers

Operating systems:Operating systems: Unix, MacOS, Windows(3.1->XP),PalmOSUnix, MacOS, Windows(3.1->XP),PalmOS Embedded devicesEmbedded devices

Networks:Networks: Ethernet, IP, USB, FireWireEthernet, IP, USB, FireWire Bluetooth, 802.11b, HomeRFBluetooth, 802.11b, HomeRF

Page 5: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Where can we agree?Where can we agree?

Hetereogenity hinders the development of Hetereogenity hinders the development of enterprise distributed systemsenterprise distributed systems

There will not be consensus onThere will not be consensus on HardwareHardware Operating systemsOperating systems Network protocolsNetwork protocols Programming languagesProgramming languages

We can agree at an higher levelWe can agree at an higher level MiddlewareMiddleware

Hetereogenity hinders the development of Hetereogenity hinders the development of enterprise distributed systemsenterprise distributed systems

There will not be consensus onThere will not be consensus on HardwareHardware Operating systemsOperating systems Network protocolsNetwork protocols Programming languagesProgramming languages

We can agree at an higher levelWe can agree at an higher level MiddlewareMiddleware

Page 6: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

MiddlewareMiddleware

A software layer that masks hetereogeneityA software layer that masks hetereogeneity Placed between operating systems and Placed between operating systems and

application componentsapplication components

Page 7: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Middleware proliferationMiddleware proliferation

Middleware itself has proliferated:Middleware itself has proliferated: CORBACORBA COM / DCOM / MTSCOM / DCOM / MTS Java / EJBJava / EJB XML / SOAPXML / SOAP C# / .NETC# / .NET

None of them prevails over the othersNone of them prevails over the others The problem remainsThe problem remains

Page 8: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

SolutionSolution

Isolate information and processing logic Isolate information and processing logic from technology specifics.from technology specifics.

Build platform independent models:Build platform independent models:• UML is independent of CORBA, COM, EJB, UML is independent of CORBA, COM, EJB,

XML, etc thus is well-suited as a language for XML, etc thus is well-suited as a language for describingdescribing

• Map these models to specific platformsMap these models to specific platforms• Maintain the separation at the implementation levelMaintain the separation at the implementation level

Page 9: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

2. MDA Overview2. MDA Overview

Page 10: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

The Object Management Group The Object Management Group (OMG)(OMG)

An open membership and no-profit An open membership and no-profit consortiumconsortium

Produces and mantains computer industry Produces and mantains computer industry specifications for interoperable enterprise specifications for interoperable enterprise applicationsapplications

Page 11: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Some of the OMG members:Some of the OMG members: AT&TAT&T BEABEA BorlandBorland BoeingBoeing CACA CitigroupCitigroup CompaqCompaq EricssonEricsson FordFord FujitsuFujitsu

GlaxoGlaxo HPHP HitachiHitachi HyperionHyperion IBMIBM IONAIONA io io

SoftwareSoftware KabiraKabira KCKC John John

DeereDeere

MicrosoftMicrosoft MITREMITRE MSC SoftMSC Soft NASANASA NECNEC NetGenicNetGenic

ss NTTNTT OASISOASIS OracleOracle PfizerPfizer

RationalRational SAGASAGA SAPSAP SASSAS SecantSecant SiemensSiemens SprintSprint SunSun UnisysUnisys VertelVertel

Page 12: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

What is the MDA?What is the MDA?

An approach to IT system specification that An approach to IT system specification that separates the specification of system separates the specification of system functionality from the specification of the functionality from the specification of the implementation of implementation of thatthat functionality on a functionality on a particular technology platformparticular technology platform

““Design once, build it on any platform”Design once, build it on any platform”

Page 13: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Some Key TermsSome Key Terms

• ModelModel• PlatformPlatform• Platform Independent Model (PIM)Platform Independent Model (PIM)• Platform Specific Model (PSM)Platform Specific Model (PSM)

Page 14: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

ModelModel

A A modelmodel is a formal specification of the function, is a formal specification of the function, structure and/or behaviour of a systemstructure and/or behaviour of a system Examples:Examples:

Source code is a modelSource code is a model An UML-based specification is a modelAn UML-based specification is a model

Models of different systems are structured Models of different systems are structured explicitly into:explicitly into: Platform Independent Models (PIM)Platform Independent Models (PIM) Platform Specific Models (PSM)Platform Specific Models (PSM)

Page 15: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

PlatformPlatform

Technological and engineering details that Technological and engineering details that are irrelevant to the fundamental are irrelevant to the fundamental functionality of a software componentfunctionality of a software component

Page 16: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Platform Independent Model Platform Independent Model (PIM)(PIM)

A “formal” specification of the structure A “formal” specification of the structure and function of a system that abstracts away and function of a system that abstracts away technical detailtechnical detail

Expressed using UMLExpressed using UML

Page 17: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

PIM: an examplePIM: an example

Page 18: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Platform Specific Model (PSM)Platform Specific Model (PSM)

Specifies how the functionality specified in Specifies how the functionality specified in a PIM is realized on a particular platforma PIM is realized on a particular platform

Expressed using UML extended with Expressed using UML extended with platform specific UML profilesplatform specific UML profiles

Page 19: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

PSM: an examplePSM: an example

Page 20: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Basic modeling technology (1/2)Basic modeling technology (1/2)

• UML – unified modeling languageUML – unified modeling languageUMLUML 被被 MDAMDA 用来描述各种模型。它并不是为用来描述各种模型。它并不是为 MDAMDA 而生,但是作而生,但是作为目前最为风行的建模语言,为目前最为风行的建模语言, UMLUML 已经占据了全球建模语言领域已经占据了全球建模语言领域9090 %的市场份额,成为了建模语言事实上的标准,因此%的市场份额,成为了建模语言事实上的标准,因此 OMGOMG 将将它作为它作为 MDAMDA 技术的基础是自然而然的明智选择。它是技术的基础是自然而然的明智选择。它是 MDAMDA 的基的基础,也是础,也是 MDAMDA 最有力的武器。最有力的武器。

• MOF – meta object facilityMOF – meta object facilityMOFMOF 是比是比 UMLUML 更高层次的抽象,它的目的是为了描述更高层次的抽象,它的目的是为了描述 UMLUML 的扩的扩展或者其它未来可能出现的类展或者其它未来可能出现的类 UMLUML 的建模语言。由此我们可以看的建模语言。由此我们可以看到到 OMGOMG 的的 "" 野心野心 "" ,虽然,虽然 MOFMOF 也不是为也不是为 MDAMDA 而生的,但是我们而生的,但是我们可以体味到可以体味到 OMGOMG 的工程师们良苦的用心和长远的目光。的工程师们良苦的用心和长远的目光。

Page 21: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Basic modeling technology (2/2)Basic modeling technology (2/2)

• XMI – XML metadata interchangeXMI – XML metadata interchangeXMIXMI 是基于是基于 XMLXML 的元数据交换。它通过标准化的的元数据交换。它通过标准化的 XMLXML 文档格式和文档格式和DTDsDTDs (( Document Type DefinitionsDocument Type Definitions )为各种模型定义了一种基于)为各种模型定义了一种基于 XMLXML的数据交换格式。这使得作为最终产品的模型可以在各种不同的工具中的数据交换格式。这使得作为最终产品的模型可以在各种不同的工具中传递,这一点是非常重要的,它保证了传递,这一点是非常重要的,它保证了 MDAMDA 不会在打破了一种束缚之不会在打破了一种束缚之后再被加上一层新的束缚。后再被加上一层新的束缚。

• CWM – CWM – common warehouse metamodel common warehouse metamodel

CWMCWM (公共仓库元模型)提供了一种数据格式变换的手段,在(公共仓库元模型)提供了一种数据格式变换的手段,在任意级别的模型上都可以使用任意级别的模型上都可以使用 CWMCWM 来描述两种数据模型之间的来描述两种数据模型之间的映射规则,比如将数据实体从关系数据库变换为映射规则,比如将数据实体从关系数据库变换为 XMLXML 格式。在格式。在MOFMOF 的框架下,的框架下, CWMCWM 使得通用的数据模型变换引擎成为可能。使得通用的数据模型变换引擎成为可能。

Page 22: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

MDA in a SnapshotMDA in a Snapshot

Core Core TechnologieTechnologie

ss

Core Target Core Target PlatformsPlatforms

Pervasive Pervasive ServicesServices

Vertical Vertical DomainsDomains

Page 23: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

3. Developing in MDA3. Developing in MDA

Page 24: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 1:Developing in MDA – Step 1:the PIM (1/2)the PIM (1/2)

All MDA development projects start with the All MDA development projects start with the creation of a PIMcreation of a PIM

PIM at this level represents business functionality PIM at this level represents business functionality and behaviour, undistorted by technology detailsand behaviour, undistorted by technology details

MDA application-modeling tools contain MDA application-modeling tools contain representations of Pervasive Services and Domain representations of Pervasive Services and Domain Facilities allowing them to be used and/or Facilities allowing them to be used and/or incorporated in the application via a menu incorporated in the application via a menu selectionselection

Page 25: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 1:Developing in MDA – Step 1:the PIM (2/2)the PIM (2/2)

PIM

Pervasive Services ModelCallsCalls

Domain Facilities

Model

CallsCalls

Page 26: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 2:Developing in MDA – Step 2:the PSM (1/2)the PSM (1/2)

Once the first iteration is complete, the PIM Once the first iteration is complete, the PIM is input to the mapping step which will is input to the mapping step which will produce a PSMproduce a PSM

Code is partially automatic and partially Code is partially automatic and partially hand-writtenhand-written

PIM can be mapped either to a single PIM can be mapped either to a single platform or to multiple platformsplatform or to multiple platforms

Page 27: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 2:Developing in MDA – Step 2:the PSM (2/2)the PSM (2/2)

PIM

CORBA Model

Maps toMaps to

Java/EJB Model

Maps toMaps to

Other Model……

Maps toMaps to

Page 28: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 3:Developing in MDA – Step 3:Generating Application (1/2)Generating Application (1/2)

An MDA tool generates all or most of the An MDA tool generates all or most of the implementation code for the deployment implementation code for the deployment technology selected by the developertechnology selected by the developer

Re-integration on new platforms can be Re-integration on new platforms can be done by reverse engineering the existing done by reverse engineering the existing application into a model and redeployapplication into a model and redeploy

Page 29: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Developing in MDA – Step 3:Developing in MDA – Step 3:Generating Application (2/2)Generating Application (2/2)

PIM

CORBA Model

Maps toMaps to

Java/EJB Model

Maps toMaps to

Other Model……

Maps toMaps to

CORBA Java/EJB Other……

Maps toMaps to Maps toMaps to Maps toMaps to

Page 30: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

4. Pros vs. Cons4. Pros vs. Cons

Page 31: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

Pros:Pros:

1.1. 模型的编写与维护模型的编写与维护• 第一第一 , , 以前的模型是自己制定的以前的模型是自己制定的 XMLXML 标标

准,现在是标准的准,现在是标准的 UMLUML 语言,谁不想自己的语言,谁不想自己的东西标准化一点,谁不想被招安阿。东西标准化一点,谁不想被招安阿。

• 第二,模型可以使用图形化的工具维护模第二,模型可以使用图形化的工具维护模型了。 型了。

2.2. 代码的生成代码的生成

Page 32: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

ConsCons (1/2):(1/2):

OMG UMLOMG UML 真的是最好的模型语言吗?真的是最好的模型语言吗?• Martin FowlerMartin Fowler 也不赞成基于也不赞成基于 OMG UMLOMG UML 的的

MDAMDA ,说,说 UMLUML 用来作为描述沟通是一个好工用来作为描述沟通是一个好工具,但作为形式化的模型描述语言就未必那么具,但作为形式化的模型描述语言就未必那么好用。甚至时序图之类的图在描述也不见得设好用。甚至时序图之类的图在描述也不见得设计得有多好,至少不见得比流程图,伪代码容计得有多好,至少不见得比流程图,伪代码容易读。易读。

• 所以,大家都喜欢所以,大家都喜欢 MDDMDD ,但未必喜欢基于,但未必喜欢基于OMG UMLOMG UML 的的 MDAMDA 。。

Page 33: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

ConsCons (2/2):(2/2):

The major drawback is that MDA does not The major drawback is that MDA does not provide a standard for the specification of provide a standard for the specification of mappingsmappings Different implementation of mappings can Different implementation of mappings can

generate very different code or modelsgenerate very different code or models This can create dependencies between the This can create dependencies between the

software and the mapping solution usedsoftware and the mapping solution used

Page 34: MDA: Model Driven Architecture 荆玲MF0933014. Summary  1. Introduction  2. MDA Overview  3. Developing in MDA  4. Pros vs. Cons.

The EndThe End