Presentation is loading. Please wait.

Presentation is loading. Please wait.

I n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development.

Similar presentations


Presentation on theme: "I n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development."— Presentation transcript:

1 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 1 - Markus Völter voelter@acm.org www.voelter.de Model-Driven Development of component-based, Distributed systems

2 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 2 - Markus Völter voelter@acm.org www.voelter.de Independent Consultant Based out of Heidenheim, Germany Focus on Software Architecture Middleware Model-Driven Software Development About me

3 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 3 - C O N T E N T S: Overview These slides are composed of three parts. All parts are rather pragmatic and based on actual experience from many projects, in various (enterprise and embedded) domains. Part 1, Introduction to MDSD Introduces Model-Driven Software Development and teaches a couple of essential best practices. Part 2, Software Architectural Approach Explains how (I think) software architecture should be addressed in non-trivial projects. Illustrated with a component-based application from the enterprise world. Part 3, A Components Reference Metamodel This section introduces a way to describe component based systems in a way that allows for all-aspect code generation. The description is introduced in the form of a metamodel.

4 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 4 - C O N T E N T S PART 1: Introduction to MDSD

5 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 5 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

6 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 6 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

7 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 7 - Domain Driven Development Domain Driven Development is about making software development more domain-related as opposed to computing related. It is also about making software development in a certain domain more efficient.

8 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 8 - MDSD on a Slide Model Domain Specific Language Metamodel textual graphical Domain Ontology bounded area of knowlege/interest semantics precise/ executable multiple partial viewpoint subdomains composable Metametamodel target software architecture software architecture transform compile interpret multi-step single-step no roundtrip knowledge several design expertise

9 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 9 - MDSD Core Values We prefer to validate software-under-construction over validating software requirements We work with domain-specific assets, which can be anything from models, components, frameworks, generators, to languages and techniques. We strive to automate software construction from domain models; therefore we consciously distinguish between building software factories and building software applications We support the emergence of supply chains for software development, which implies domain-specific specialization and enables mass customization

10 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 10 - MDSD Core Building Blocks domain analysis meta modelling model-driven generation (and: model transformation) template languages domain-driven framework design the principles for agile software development the development and use of Open Source infrastructure

11 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 11 - DSLs in Industry Model-Driven Development (MDSD) pragmatic technology, process building blocks OMG’s Model-Driven Architecture (MDA) standardization effort, technology-focus, platform independence, m2m transformations Microsoft’s Software Factories (SF) framework for domain-specific IDE tooling, DSLs are part of this approach Generative Programming (GP) traditional small scale, technology focused Language-Oriented Programming (LOP) integrate DSLs into IDE with editors, debuggers, symbolic integration

12 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 12 - Reasons for using DSLs You want to provide a way for your domain-experts to formally specify their knowledge, and to provide a way for your technology people to define how this is implemented (using model transformations). You might want to provide different implementations (i.e. more concrete models) for the same model, perhaps because you want to run it on different platforms (.NET, Java, CORBA). You may want to capture knowledge about the domain, the technology, and their mapping in a clear, uncluttered format. In general, you don’t want to bother with implementation details when specifying your functionality.

13 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 13 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

14 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 14 - MDSD Benefits I Models are free of implementation artifacts – they directly represent domain knowledge and are thus reusable. Implementations for various platforms can be generated in principle – the technology change problem is adressed to some extend. Technology freaks and domain experts can take care of „their business“ (transformations and models, respectively) and need to care of each other‘s problems only in a limited way. Domain experts can play a direct role in development since they can more easily understand models expressed with a DSL as opposed to implementation code.  Domain Experts play the central role they deserve!

15 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 15 - MDSD Benefits II Development becomes more efficient since repetitive implementation code can be generated automatically. Architectural contraints/rules/patterns can more easily be enforced, since the they are embedded in the templates rather than just being documented (and ignored). This is especially important in really large teams, often in the context of Product-Line Engineering and Software System Families. Transformer/Generator can address cross-cutting concerns (just like an aspect weaver)

16 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 16 - Benefits for Software Quality DSLs, if they describe software structure/architecture requires an explicit, well-defined architecture. Defining an architecture this way improves the quality of the system (indpendent of whether it is generated or not). Transformations capture expert knowledge. The generated code reflects this expert knowledge uniformly. An DSL-based Archtitecture defines a strict programming model for the manually developed parts – again, uniformity and constrained-ness improves quality. Generator does not produce accidental errors – either things are always right or always wrong. This makes finding errors easier!

17 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 17 - Benefits for Software Quality II In general, defining a DSL forces you to take care of many good things, which you‘d like to have in any application development project: Domain/Application Scoping Variability Management Well-Defined Software Architecture, Architecture Metamodelling Trying to build a DSL/generator for a domain/target architecture enables your understanding of the domain/target architecture. This in itself is a huge benefit.

18 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 18 - DSL/Code Generation “Financial Benefits” „Normal“ Implementation Effort

19 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 19 - DSL/Code Generation “Financial Benefits” II Realistic DSL based Implementation Effort

20 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 20 - DSL/Code Generation “Financial Benefits” III Ideal DSL based Implementation Effort

21 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 21 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

22 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 22 - How DSLs are usually used Developer develops model(s) based on certain metamodel(s), expressed using a DSL. Using code generation templates, the model is transformed to executable code. Alternative: Interpretation Optionally, the generated code is merged with manually written code. One or more model-to- model transformation steps may precede code generation.

23 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 23 - Example Tool: openArchitectureWare Generator How it works:

24 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 24 - How Transformations Work Transformations (Model-2-Model as well as Model-2-Code) are at the heart of MDSD. However, due to limitations in space and time, I cannot provide details on how these work, except: For M2M Transformations, various textual or graphical languages exist (or are being worked on), some of them rule- based, others imperative. The simplest thing that could possibly work are 3GL procedures (e.g. in Java) that work on model elements directly. This works well in practice if metamodel API is good. For Code Generation, almost all generators use template- based approaches, where template control code is intertwined with to-be-generated code; the to-be-generated code is parametrized by „properties“ that get their values from the underlying model.

25 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 25 - How Transformations Work II - Example Template (oAW)

26 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 26 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

27 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 27 - DSLs/Generation and Agility Agile Manifesto: We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value: - Individuals and interactions over processes and tools - Working software over comprehensive documentation - Customer collaboration over contract negotiation - Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more. DSL-based Models are no „paperwork“, they are the code which is translated to executable code automatically Agility does not oppose tools in general – compilers are ok, model transformers are a kind of compiler

28 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 28 - MDSD and Agility II Project automation (ant, cruisecontrol) is ok in „agile minds“, so is automation of the writing of repetitive code Automation of the development process makes responding to change easier and faster (single source principle). Changes in the model respond to changes in the functional requirements Changes in the templates/transformations can be used to evolve the architecture The customer on-site can be integrated better, if we have languages that are better related to domain concepts as opposed to 3GL code or the like. Pair programming between developer and domain expert is more realistic.

29 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 29 - MDSD and Agility III Tests can still be written manually (even before generation), generators can help is building mocks or scenarios We have done Test-Driven, Model-Driven Development We do not recommend a waterfall that first builds metamodel/DSL/generators and then builds apps, rather, both are iteratively evolved in parallel. Domains Architectures are based on experience, not based on „big design upfront“ Developers can do what they can do best: Some deal with applications and customer requirements, Others deal with technical architecture, platforms and generators So: There is no conflict between Agility and DSLs/Generation!

30 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 30 - Teaming issues Using DSLs is not very different from “normal” programming – every developer can basically do it. Defining DSLs is, however, something completely different: Finding the „right“ abstractions, defining metamodels, keeping the various metalevels sorted, etc. is not everybody‘s business. Some of the tools to define metamodels, DSLs, generators and model-2-model transformations are not (yet) intuitively usable. Therefore I recommend to keep DSL/generator development to a limited group of people in your project.

31 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 31 - Teaming issues II - Roles Not all of these roles are necessary in every project, of course However, as an example, there is a fundamental difference between those who understand the domain and its abstractions (left branch) compared to those who know how to best use some platform technology (right branch)

32 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 32 - Iterative Dual Track Development Develop DSL/Generator and at least one application at the same time. Establish rapid feedback from application developers to domain architecture developers. Develop both aspects iteratively and incrementally. Use strict timeboxing. Infrastructure develops iteration n+1 whereas application developers use iteration n. Introduce new DSL/Generator releases only at the beginning of iterations.

33 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 33 - Iterative Dual Track Development II - Roles Note that the „men“ in the diagram on the right are roles, you can easily have some of them be handled by the same person!

34 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 34 - Extract the Infrastructure Before starting ITERATIVE DUAL-TRACK DEVELOPMENT, Extract the transformations from manually developed application. Either, start by developing this prototype conventionally, then build up the DSL/Generator infrastructure based on this running application, Or extract the code from applications developed in the respective domain before doing MDSD (but only if the quality is sufficiently good!)

35 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 35 - C O N T E N T S: Part 1, Introduction to MDSD What is MDSD Benefits Mechanics and Tooling Process Issues Some Essential Best Practices

36 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 36 - How do I come up with a good metamodel? Incrementally! Based on experience from previous projects, and by „mining“ domain experts. A very good idea is to start with a (typically) very well known domain: the target software architecture (platform)  Architecture-Centric DSLs  see below, Cascading

37 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 37 - How do I come up with a good metamodel? II In order to continuously improve and validate the metamodel for a domain, it has to be exercised with domain experts as well as by the development team. In order to achieve this, it is a good idea to use it during discussions with stakeholders by formulating sentences using the concepts in the meta model. As soon as you find that you cannot express something using sentences based on the meta model, you have to reformulate the sentence the sentence’s statement is just wrong you have to update the meta model. (Based on Eric Evans’ Ubiquitous Language)

38 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 38 - How do I come up with a good metamodel? III A component owns any number of ports. Each port implements exactly one interface. There are two kinds of ports: required ports and provided ports. A provided port provides the operations defined by its interface. A required port provides access to operations defined by its interface. Example:

39 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 39 - One DSL is not enough Most systems can be structured into various partitions: functional subsystems subdomains: technical aspects It is hardly possible to describe each of these with the same DSL. You will need to come up with separate DSLs … that have to be „connectable“ in order to build the complete system

40 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 40 - One DSL is not enough II Structure your system into several technical subdomains such as persistence, GUI, deployment. Each subdomain should have its own meta model and specifically, its own suitable DSL. Define a small number of gateway metaclasses, i.e. meta model elements that occur in several meta models to help you join the different aspects together.

41 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 41 - One DSL is not enough III - Example

42 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 42 - Rich Domain-Specific Platform Define a rich domain-specific application platform consisting of Libraries Frameworks base classes interpreters, etc. The transformations will “generate code” for this domain-specific application platform. As a consequence, the trans- formations become simpler. DSLs and Frameworks are two sides of the same coin

43 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 43 - Rich Domain-Specific Platform II - Integration A) Generated code can call non-generated code contained in libraries B) A non-generated framework can call generated parts. C) Factories can be used to „plug-in“ the generated building blocks D) Generated classes can also subclass non-generated classes. E) The base class can also contain abstract methods that it calls, they are implemented by the generated subclasses (template method pattern)

44 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 44 - External Model Markings (AO-Modelling) In order to allow the transformation of a source model into a target model (or to generate code) it is sometimes necessary to provide “support” information that is specific to the target meta model. Example: Entity Bean vs. Type Manager Adding these to the source model “pollutes” the source model with concepts specific to the target model. MDA proposes to add “model markings”, but this currently supported well by only very few tools. Instead, we recommend keeping this information outside of the model (e.g. in an XML file); the transformation engine would use this auxiliary information when executing the transformations.

45 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 45 - Testing through Model Verification In many cases it is possible to detect design errors already in the models. This step is called model verification. The most „extreme“ form is to interpret and simulate the whole model; this is however, not simple to achieve. However, it is easily possible to verify design constraints in the model before model transformation or code generation steps are done. So, a DSL definition includes checks („constraints“) that determine if a model is correct. Note that those constraints report errors in a language that is on the same abstraction level as the DSL – i.e. no low level compiler errors!

46 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 46 - Testing through Model Verification II - Example Example Metamodel

47 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 47 - Testing through Model Verification III – Example cont‘d Verifications in the metamodel (Implemented) public class ECInterface extends generatorframework.meta.uml.Class { public String CheckConstraints() { Checks.assertEmpty( this, Attribute(), "must not have attributes." ); } // more … } public class Component extends generatorframework.meta.Class { public String CheckConstraints() { Checks.assertEmpty( this, Operation(), "must not have attributes." ); Checks.assertEmpty( this, Generalization(), "must not have superclasses or subclasses." ); Checks.assertEmpty( this, Realization(), "must not implement any interface." ); Checks.assertUniqueNames( this, Port(), "a component's ports must have unique names." ); } // more … }

48 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 48 - C O N T E N T S PART 2: Software Architectural Approach

49 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 49 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

50 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 50 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

51 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 51 - The Problem I think the craft of software architecture in current industrial practice is not what it should be. As a consequence, software development is too complicated too expensive hard to test has to change too much if technology changes Specifically, Software architecture is too much technology driven. It is to be a slave to hypes and buzzwords Standards are used in too eagerly

52 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 52 - Problem: Technology-Driven You hear statements such as “we have a web-service architecture”, “EJB Architectures”, “Thin Client Architecture”. Such a this statement is stupid because it describes only one aspect of the overall system, And focuses on the implementation technology for that aspect. An early commitment to a specific technology usually results in blindness for the concepts a too tight binding to the particular technology. a complicated programming model, bad testability and no flexibility to change the technology, as QoS requirements evolve.

53 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 53 - Problem: Hype and Buzzwords It is good practice to characterize an architecture as implementing a certain architectural style or pattern. But some of the buzzwords used today are not even clearly defined. A “service oriented architecture” is a classic. Nobody knows what this really is, and how it is different from well-designed component- based systems. And there are many misunderstandings. People say “SOA”, and others understand “web service”… A hype-based architecture often leads to too early (and wrong) technology decisions – see previous slide!

54 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 54 - Problem: Industry Standards Standard definition, good old times. try a couple of alternatives; see which one is best; set up a committee that defines the standard the standard is usually close to the solution that worked best. Standard definition, today: Standards are often defined by a group of (future) vendors. Either they already have tools, which the standard must consider or there is no practical previous experience and the standard is defined “from scratch”. Standards are often not usable because there was no previous experience, or they are overly complicated because it must satisfy all the vendors…. Thus, if you use standards for too many aspects of your system, your system will be complicated!

55 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 55 - Problem: Architecture Degradation It is one thing to define a „good“ architecture (assuming we know what „good“ means for a project) It is, however, much more complicated to make sure the architecture is lived in the project. Communication Competence Ignorance The goal: We (the team, architects, dictator…) want to make architectural decisions when we see the need to decide Then we want to ensure that everybody respects and follows the decision… …until we find the decision has to be revised… which is when we change it … but then, again, everybody has to follow the new decision…

56 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 56 - Problem: Politics © Die Gerd Show / Elmar Brandt I‘d rather prefer the blue Database over the red one. I would be the first one in the company to use web service standards…

57 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 57 - Phase 1: Elaborate! This section outlines best practices and approaches which I think are important and applicable for all kinds of projects – you don't want to go without these. This first elaboration phase should be handled by a small team, before the architecture is rolled out to the team as a whole. We want to build an enterprise system that contains various subsystems such as customer management, billing and catalogs. In addition to managing the data using a database, forms and the like, we also have to manage the associated long-running business processes. We will look at how we can attack this problem below.

58 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 58 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

59 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 59 - PATTERN: Technology-Independent Architecture Context: You have to define a software architecture for a non-trivial system Problem: How do you define a software architecture that is well-defined, long-lived and feasible for use in practice? The architecture has to be reasonable simply and explainable on a beer mat. Forces Architectural concepts must be communicated to stakeholders and developers Implementation of functional requirements should be as efficient as possible. The architecture must “survive” a long time, longer than the typical hype or technology cycles The architecture might have to evolve with respect to QoS levels such as performance, resource consumption or scalability.

60 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 60 - PATTERN: Technology-Independent Architecture II Solution: Define the archtitectural concepts independent of specific technologies and implementation strategies. Clearly define concepts, constraints and relationships of the architectural building blocks – a glossary or an ARCHITECTURAL METAMODEL can help here. Define a TECHNOLOGY MAPPING in a later phase to map the the artefacts defined here to a particular implementation platform. Use the well-known architectural styles and patterns here. Typically these are best practices for architecting certain kinds of systems independent of a particular technology. They provide a reasonable starting point for defining (aspects of) your systems's architecture.

61 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 61 - PATTERN: Technology-Independent Architecture III We decide that our system will be built from components. Each component can provide a number of interfaces. It can also use a number of interfaces (provided by other components). Communication is synchronous, Communication is also restricted to be local We design components to be stateless. In addition to components, we also explicitly support business processes. These are modelled as a state machine. Components can trigger the state machine by supplying events to them. Other components can be triggered by the state machine, resulting in the invocation of certain operations. Communication to/from processes is asynchronous, remote communication is supported.

62 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 62 - PATTERN: Technology-Independent Architecture IV Rationale and Consequences: You can focus more on the structure, responsibilities and collaborations among the parts of your systems. Implementation of functionality becomes more efficient. And you don't have to educate all developers with all the details of the various technologies that you'll eventually use. So, how much technology is in a technology- independent architecture? All technologies or approaches that provide additional expressive concepts are useful in a TECHNOLOGY- INDEPENDENT ARCHITECTURE. AOP is such a candidate. The notion of components is also such a concept. Message queues, pipes and filters and in general, architectural patterns are also useful.

63 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 63 - PATTERN: Technology-Independent Architecture V Rationale and Consequences cont‘d: When documenting and communicating your TECHNOLOGY- INDEPENDENT ARCHITECTURE models are useful. Simple box and line diagrams, layer diagrams, sequence, state or activity charts can help to describe what the architecture is about. They are used for illustrative purposes, to help reason about the system, or to communicate the architecture. For this very reason, they are often drawn on beer mats, flip charts or with the help of Visio or Powerpoint. While these are not formal, you should still make sure that you define what a particular visual element means intuitively – boxes and lines with no defined meaning are not very useful, even for non-formal diagrams.

64 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 64 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

65 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 65 - PATTERN: Programming Model Context: You have defined a TECHNOLOGY INDEPENDENT ARCHITECTURE. Problem: The architecture is a consequence of non-functional requirements and the basic functional application structure, which might make the architecture non-trivial and hard to comprehend for developers. How can you make the architecture accessible to (large numbers of) developers? Forces You want to make sure the architecture is used “correctly” to make sure it’s benefits can actually materialize. You have developers of different qualifications in the project team. All of them have to work with the architecture. You want to be able to review application code easily and effectively. Your applications must remain testable.

66 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 66 - PATTERN: Programming Model II Solution: Define a simple and consistent programming model. A programming model describes how an architecture is used from a developer’s perspective. It is the “architecture API”. The programming model must be optimized for typical tasks, but allow for more advanced things if necessary. Note that a main constituents of a programming model is a How-To Guide that walks developers through the process of building an application. The programming model uses a simple IOC approach à la Spring to define component dependencies on an interface level. An external XML file takes care of the configuration of the instances.

67 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 67 - PATTERN: Programming Model III The following piece of code shows the implementation of a simple example component. Note how we use Java 5 annotations Processes engines are components like any other. For triggers, they provide an interface w/ void operations They also define interfaces with the actions that those components can implement that want to be notified of state changes. public @component class ExampleComponent implements HelloWorld { // provides HelloWorld private IConsole console; public @resource void setConsole( IConsole c ) { this.console = c; // setter for console } // component public void sayHello( String s ) { console.write( s ); } }

68 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 68 - PATTERN: Programming Model IV public @process class SomeProcess implements ISomeProcessTrigger { private IHelloWorld resource; public @resource void setResource( IHelloWorld w ) { this.resource = w; } public @trigger void T1( int procID ) { SomeProcessInstance i = loadProcess( procID ); if ( guardG1() ) { // advance to another state… } } public @trigger void T2( int procID ) { SomeProcessInstance i = loadProcess( procID ); // … resource.sayHello( "hello" ); } } Process Component Implementation Example

69 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 69 - PATTERN: Programming Model V Rationale and Consequences: The most important guideline when defining a programming model is usability and understandability for the developer. Frameworks, libraries, and domain-specific languages are useful Platform might have consequences for the programming model. For example, if you want to be able to deploy something as an enterprise bean, you should not create objects yourself. Therefore: Always develop against interfaces, not implementations Never create objects yourself, always use factories Use factories to access resources (such as database connections) Stateless design is a good idea in enterprise systems Separate concerns: make sure a particular artifact does one thing, not five.

70 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 70 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

71 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 71 - PATTERN: Technology Mapping Context: You have defined a TECHNOLOGY INDEPENDENT ARCHITECTURE and a PROGRAMMING MODEL. Problem: Your software has to deliver certain QoS levels. Implementing QoS as part of the project is costly. You might not even have the appropriate skills on the team. Also, your system might have to run with different levels of QoS, depending on the deployment scenario. Forces You don't want to implement QoS stuff yourself. You want to keep the conceptual discussions, as well as the PROGRAMMING MODEL free from technical issues. You might want to run the system with various levels of QoS, with minimal cost for each.

72 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 72 - PATTERN: Technology Mapping II Solution: Map the TECHNOLOGY-INDEPENDENT ARCHITECTURE to a specific platform that provides the requires QoS. Make the mapping to the technology explicit. Define rules how the conceptual structure of your system (the metamodel) can be mapped to the technology at hand. Define those rules clearly to make them amenable for GLUE CODE GENERATION. Decide about standards usage here, not earlier. But keep in mind: First solve the problem. Then look for a standard. Not vice versa. Use technology-specific Design Patterns here. Use them as the basis for the TECHNOLOGY MAPPING.

73 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 73 - PATTERN: Technology Mapping III For the remote communication between business processes we will use web services. From the interfaces such as IHelloWorld, we generate a WSDL file, and the necessary endpoint implementation. We use on of the many available web service frameworks. Spring will be used as long a no advanced load balancing and transaction policies are required. Once this becomes necessary, we will use Stateless Session EJBs. The necessary code to wrap our components inside beans is easy to write.

74 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 74 - PATTERN: Technology Mapping IV Persistence for the process instances – like any other persistent data – is managed using Hibernate. To make this possible, we create a data class for each process. Since this is a normal value object, using Hibernate to make it persistent is straight forward

75 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 75 - PATTERN: Technology Mapping V Rationale and Consequences: The question is, which technology do you chose? In general, this is determines by the QoS requirements you have to fulfill. Platforms are good at handling technical concerns such as transactions, distribution, threading, load-balancing, failover or persistence. You don't want to implement these yourself. So, always use the platform that provides the services you need, in the QoS level you are required to deliver. Often this is deployment specific!

76 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 76 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

77 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 77 - PATTERN: Mock Platform Context: You have a nice PROGRAMMING MODEL in place. Problem: Developers have to be able to run (parts of) the system locally, at least to run unit tests. How can you make sure developers can run "their stuff" locally without caring about the TECHNOLOGY MAPPING and its potentially non-trivial consequences for debugging and test setup? Forces Developers have to run their code as early as possible You want to minimize dependencies on other project members, specifically those caring about the TECHNOLOGY MAPPING. You have to make sure developers can efficiently run unit tests.

78 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 78 - PATTERN: Mock Platform II Solution: Define the simplest TECHNOLOGY MAPPING that could possibly work. Provide a framework that mocks or stubs the architecture as far as possible. Make sure developers can test their application code without caring about QoS and technical infrastructure. Since we are already using a PROGRAMMING MODEL that resembles Spring, we use the Spring container to run the application components locally. Stubbing out parts is easy based on Springs XML configuration file. Since persistence is something that Hibernate takes care of for us, the MOCK PLATFORM simply ignores the persistence aspect.

79 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 79 - PATTERN: Mock Platform III Rationale and Consequences: This is essential for unit testing! Testing one's business logic is simply if you have your system well modularized. If you stick to the guidelines given in the PROGRAMMING MODEL pattern (interfaces, factories, separation of concerns) it is easy to mock technical infrastructure and other artifacts developed by other people. Note that it's essential that you have a clearly defined programming model, otherwise you TECHNOLOGY MAPPING will not work reliably. Note that the tests you run on the MOCK PLATFORM will not find QoS problems – QoS is provided by the execution platform.

80 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 80 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

81 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 81 - PATTERN: Vertical Prototype Context: You have a TECHNOLOGY INDEPENDENT ARCHITECTURE, a PROGRAMMING MODEL as well as a TECHNOLOGY MAPPING. The first implementations of functionality are available and tested using the MOCK PLATFORM. Problem: QoS depends on the technology platform, you selected only recently in the TECHNOLOGY MAPPING. How do you make sure you don’t run into dead-ends? Forces You want to keep your architecture as free of technology specific stuff as possible. However, you want to be sure that you can address all the non-functional requirements. You want to make sure you don’t invest into unworkable technology mappings

82 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 82 - PATTERN: Vertical Prototype II Solution: Make sure you test the non-functional requirements! Build a prototype application that uses all of the above and implements it only for a very small subset of the functional requirements. This specifically includes performance and load tests. Work on performance improvements here, not earlier. It is bad practice to optimize design for performance from the beginning, since this often destroys good architectural practice. In certain domains, there are patterns to realize certain QoS properties (such as stateless design for large-scale business systems). You shouldn't ignore these intentionally at the beginning.

83 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 83 - PATTERN: Vertical Prototype III The vertical prototype includes parts of the customer and billing systems. For creating an invoice, the billing system uses normal interfaces to query the customer subsystem for customer details. The invoicing process is based on a long-running process. A scalability test was executed and resulted in two problems: For short running processes, the repeated loading and saving of persistent process state had become a problem. A caching layer was added. Second, web-service based communication with process components was a problem. Communication was changed to CORBA for remote cases that were inside the company

84 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 84 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

85 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 85 - Phase 2: Iterate! Now that you have the basic mechanisms in place you should make sure that they actually work for your project. Therefore, iterate over the previous steps until they are reasonable stable and useful. Spring was intended for the production environment. New requirements (versioning!) have made this infeasible. Spring does not support two important features: Dynamic installation/de-installation of components, and isolations of components from each other(classloaders). Eclipse has been chosen as the new execution framework. The PROGRAMMING MODEL did not change; the TECHNOLOGY MAPPING, however, had to be adapted.

86 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 86 - C O N T E N T S The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

87 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 87 - Phase 3: Automate! The steps outlined above are useful in any kind of project. In case your project is really large (i.e. you have a large number of developers), or in case your TECHNOLOGY MAPPING or the PROGRAMMING MODEL is too tedious to use, you should consider automating the development. The next set of patterns describes how.

88 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 88 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

89 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 89 - PATTERN: Architecture Metamodel Context: You have a TECHNOLOGY-INDEPENDENT ARCHITECTURE. You want to automate various tasks of the software development processes. Problem: To automate, you have to codify the rules of the TECHNOLOGY MAPPING Thus, you have to be very clear and precise about the artifacts defined in your TECHNOLOGY-INDEPENENT ARCHITECTURE. Forces Automation cannot work if you can't formalize translation rules. An architecture based on prose text is not formal enough. You want to be able to check models for architectural consistency.

90 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 90 - PATTERN: Architecture Metamodel II Solution: Define a formal architecture metamodel. An architecture metamodel formally defines the concepts of the TECHNOLOGY-INDEPENDENT ARCHITECTURE. Ideally this metamodel is also useful in the transformers/generators that are used to automate development.

91 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 91 - PATTERN: Architecture Metamodel III

92 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 92 - PATTERN: Architecture Metamodel IV Rationale and Consequences: Formalization is a double-edged sword. While it has some obvious benefits, it also requires a lot more work than informal models. The only way to justify the extra effort is if the metamodel is really used by tools in the development process, such as as part of the code generation in DSL-BASED PROGRAMMING MODELS and ARCHITECTURE-BASED MODEL VERIFICATION

93 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 93 - C O N T E N T S: Part 2, Software Architectural Approach S The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

94 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 94 - PATTERN: Glue Code Generation Context: You have a TECHNOLOGY INDEPENDENT ARCHITECTURE, as well as a working TECHNOLOGY MAPPING. Problem: The TECHNOLOGY MAPPING – if sufficiently stable – is typically repetitive and thus tedious and error prone to implement. Often information that is already defined in the artifacts of the PROGRAMMING MODEL have to be repeated in the TECHNOLOGY MAPPING code (method signatures are typical examples). Forces A repetitive, standardized technology mapping is good since it is a sign of a well though-out architecture Repetitive implementations always tend to lead to errors and frustration.

95 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 95 - PATTERN: Glue Code Generation II Context: Based on the specifications of the TECHNOLOGY MAPPING, use code generation to generate a glue code layer, and other adaptation artifacts such as descriptors, configuration files, etc. To make that feasible you might have to formalize your TECHNOLOGY INDEPENDENT ARCHITECTURE into an ARCHITECTURAL METAMODEL. In order to be able to get access to the necessary information for code generation, you might have to use a DSL-BASED PROGRAMMING MODEL.

96 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 96 - PATTERN: Glue Code Generation III Our scenario has several useful locations for glue code generation. We generate the Hibernate mapping files We generate the web service and CORBA adapters based on the interfaces and data types that are used for communication. The generator uses reflection to obtain the necessary type information. Finally, we generate the process interfaces from the state machine implementations. In the programming model, we use Java 5 annotations to mark up those aspects that cannot be derived by using reflection alone. Annotations can help a code generator to "know what to generate" without making the programming model overly ugly.

97 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 97 - PATTERN: Glue Code Generation IV Rationale and Consequences: Build and test automation is an established best practice in current software development. The natural next step is to automate programming – at least those issues that are repetitive and governed by clearly defined rules. Generating these artifacts has several advantages. It's simply more efficient. The requirement to "implement" the TECHNOLOGY MAPPING in the form of a generator helps refine the TECHNOLOGY MAPPING rules. Code quality will typically improve, since a code generator doesn't make any accidental errors Developers are relieved from having to implement tedious glue code over and over again

98 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 98 - C O N T E N T S: Part 2, Software Architectural Approach S The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

99 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 99 - PATTERN: DSL-based Programming Model Context: You have a PROGRAMMING MODEL defined. Problem: Your PROGRAMMING MODEL is still too complicated, with a lot of domain-specific algorithms implemented over and over again. It is hard for your domain experts to use the PROGRAMMING MODEL in their everyday work. And the GLUE CODE GENERATION needs information about the program structure that is hard or derive from the code Forces The code-based PROGRAMMING MODEL can’t use domain-specific notations Parsing code in order to gain information on what kind of glue code to generate is tedious, and the code also does not have the necessary semantic richness.

100 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 100 - PATTERN: DSL-based Programming Model II Solution: Define Domain-Specific Languages that developers use to describe application structure and behavior in a brief and concise manner. Generate the lower-level implementation code from these models. Generate a skeleton against which developers can code those aspects that cannot be completely generated from the models. We use DSLs for components, interfaces and dependencies. Describing this aspect in a model has two benefits: First, the GLUE CODE GENERATION can use a more semantically rich model as its input, and the model allows for very powerful MODEL-BASED ARCHITECTURE VALIDATION (see below).

101 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 101 - PATTERN: DSL-based Programming Model III From these diagrams, we can generate a skeleton component class all the necessary interfaces. Developers simply inherit from the generated skeleton and implement the operations defined by the provided interfaces.

102 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 102 - PATTERN: DSL-based Programming Model IV A second place is the processes. State machines can be “drawn” using UML state machines. To integrate processes with other components, these can easily be rendered by “black- boxing” the state machine with a component and using it in component diagrams. The component is derived from the state chart automatically.

103 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 103 - PATTERN: DSL-based Programming Model V

104 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 104 - PATTERN: DSL-based Programming Model VI

105 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 105 - PATTERN: DSL-based Programming Model VII

106 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 106 - PATTERN: DSL-based Programming Model VIII Rationale and Consequences: Defining useful DSLs, providing a suitable editor, and implementing an generator creates efficient code is a non-trivial task. So this step only makes sense if the generator is reused often, the "normal" PROGRAMMING MODEL is so intricate, that a DSL boosts productivity, or if you want to do complex MODEL-BASED ARCHITECTURE VALIDATION.

107 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 107 - PATTERN: DSL-based Programming Model IX Rationale and Consequences cont’d: The deeper your understanding of the domain becomes, the more expressive your DSL can become (and the more powerful your generators have to be). In order to manage the complexity, you should build cascades of DSL/Generator pairs. The lowest layer is basically the GLUE CODE GENERATOR; higher layers provide more and more powerful DSL-BASED PROGRAMMING MODELS.

108 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 108 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

109 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 109 - PATTERN: Model-Based Architecture Validation Context: You have all the things from above in place and you roll out your architecture to a larger number of developers. Problem: You have to make sure that the PROGRAMMING MODEL is used in the intended way. Different people might have different qualifications. Using the programming model correctly is also crucial for the architecture to deliver it QoS promises. Forces: Checking a system for “architectural compliance” is critical! Using only manual reviews does not scale Since a lot technical complexity is taken away from developers (it is in the generated) these issues need not be checked. Checking the use of the PROGRAMMING MODEL on source level is complicated

110 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 110 - PATTERN: Model-Based Architecture Validation II Solution: Make sure critical architectural things are either specified as part of the DSL-BASED PROGRAMMING MODEL, or the developers are restricted in what they can do be the generated skeleton, into which they add their 3GL code. Architectural verifications can then be done on model level, which is quite simple: it can be specified against the constraints defined in the ARCHITECTURE METAMODEL. It is checked that for triggers in processes there is a component that calls the trigger. Dependency management: It is easy to detect circular dependencies among components. Components are assigned to layers (app, service, base) and dependencies are only allowed in certain directions. The component signature generated from the model prevents developers from creating dependencies to components that are not described in the model

111 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 111 - PATTERN: Model-Based Architecture Validation III Another really important aspect in our example system is evolution of interfaces:

112 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 112 - PATTERN: Model-Based Architecture Validation IV Rationale and Consequences: In larger projects, you have to be able to verify the properties of your system (from an architectural point of view) via automated checks. Some of them can be done on code level (using metrics, etc.). However, if you have the system's critical aspects described in models, you have much more powerful verification and validation tools at hand. It is essential that you can use the ARCHITECTURE METAMODEL to verify models/specifications. Good tools for model-driven software development (such as the openArchitectureWare generator) can read (architecture) metamodels and use them to validate input models.

113 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 113 - PATTERN: Model-Based Architecture Validation V Rationale and Consequences cont’d: This way, a metamodel is not “just documentation”, it is an artifact used by development tools. The following illustration shows how this tool works.

114 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 114 - C O N T E N T S: Part 2, Software Architectural Approach The Problem PHASE 1: Elaborate! Technology-Independent Architecture Programming Model Technology Mapping Mock Platform Vertical Prototype PHASE 2: Iterate! PHASE 3: Automate! Architecture Metamodel Glue Code Generation DSL-based Programming Model Model-based Architecture Validation Summary

115 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 115 - Summary The approach to software architecture described in this papers is a tried and trusted one. However, it is often not used … Why? People think it is too complicated to use. And it's not "standard". To some extend this is true. Defining your own PROGRAMMING MODEL certainly means, that not all developers will learn each and every J2EE detail. While this might be considered a problem by some developers (for their CVs), it is certainly a good thing wrt. productivity.

116 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 116 - C O N T E N T S PART 3: Components Reference Metamodel

117 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 117 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

118 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 118 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

119 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 119 - Why? Based on my experience, the core “asset” in model-driven component based development is not a generator that generated some J2EE code, rather, the “right” selection of models and viewpoints is essential. So these slides contain exactly this: a reference metamodel that has been used in many, many different projects.

120 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 120 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

121 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 121 - Three Basic Viewpoints Type Model: Components, Interfaces, Data Types Composition Model: Instances, “Wirings” System Model: Nodes, Channels, Deployments

122 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 122 - Three Basic Viewpoints – Generated Stuff Base classes for component implementation Build-Scripts Descriptors Remoting Infrastructure Persistence …

123 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 123 - Type Metamodel

124 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 124 - Type Metamodel II (Data)

125 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 125 - Composition Metamodel

126 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 126 - System Metamodel

127 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 127 - Viewpoint Dependencies Dependencies between Viewpoint Models are only allowed in the way shown below in order to Be able to have several compositions per type model And several system models per composition This is important to be able to have several “systems”, Several deployed locally for testing, using only a subset of the defined components, And “the real system”

128 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 128 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

129 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 129 - Component Implementation We have not yet talked about the implementation code that needs to go along with components. As a default, you will provide the implementation by a manually written subclass However, for special kinds of components (“component kind” will be defined later) can use different implementation strategies -> Cascading!

130 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 130 - Component Implementation II Remember the example of the process components from before: Various other implementation stragies can be used, such as: Rule-Engines “Procedural” DSLs or action semantics Note that, here, interpreters can often be used sensibly instead of generating code!

131 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 131 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

132 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 132 - Aspect Models Often, the described three viewpoints are not enough, additional aspects need to be described. These go into separate aspect models, each describing a well-defined aspect of the system. Each of them uses a suitable DSL/syntax The generator acts as a weaver Typical Examples are Persistence Security Forms, Layout, Pageflow Timing, QoS in General Packaging and Deployment Diagnostics and Monitoring

133 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 133 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

134 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 134 - Separate Interfaces You might not need separate Interfaces Operations could be annotated directly to components Dependencies would be to components, not to interfaces Relationships between interfaces are often needed, “if you require this interface, you also have to provide that one”

135 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 135 - Component Types Often different “kinds” of Components are needed. To manage dependencies, And to define implementation strategies

136 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 136 - Component Layering Alternatively you can simply annotate each component with a layer

137 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 137 - Component Signatures You might need to provide several implementations (i.e. components) for the same signature (i.e. provided/required interfaces). So you need to separate implementation from signature

138 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 138 - Hierarchical Components

139 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 139 - Hierarchical Components II This allows an infinite nesting of component structures It requires the concept of ports Note that the clear boundaries between type and composition models are blurted (which makes this approach a bit more advanced!) Example:

140 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 140 - Configuration Parameters Parameters allow for dynamic configuration of components. There is a wide variety of potential value definition scopes

141 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 141 - Behaviour Different (types of) Components typically have different lifecycles The threading model is typically different, too. Also, some components might be stateless, while others are stateful (with persistent state, or not)

142 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 142 - Asynchronous Communication Some components might need asynchronous communication with others Note that this has to be specified in the type model – since it affects the API!

143 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 143 - Events Events are a way to signal information from a component to another, asynchronously. Sometimes it is useful to allow for violations of the (otherwise rigidly enforced) dependency rules

144 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 144 - Subsystems and Business Components If the number of components grows, additional means to organize them are required. The internal structure of subsystems or business components can be defined by enforcing certain policies wrt. Component types For example, each business component must have exactly one facade

145 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 145 - Data More elaborate data structures are often required Typical example is based on entities and dependent types DAOComponents are used to manage the entities and their associated dependent types Ownership and Scope of data types is essential Indirect dependency management packaging

146 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 146 - Wiring Optional wires might be useful Dynamic Wires don’t specify the target instance, but rather a set of properties based on which at runtime, the target can be found Important for dynamic systems, e.g. P2P

147 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 147 - Container Types and Networks This allows for more specific description of hardware, Networks and network types describe means to communicate Whereas container types are important to distinguish various execution environments (server, local, …)

148 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 148 - Versioning Capturing versioning and type evolution information explicitly in the model allows for definitive statements about component compatibility and system evolution.

149 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 149 - C O N T E N T S: Components Reference Metamodel Why? Three basic Viewpoints and their Metamodels Component Implementation Aspect Models Variants Code Generation revisited

150 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 150 - Code Generation Revisited The discussions previously have only discussed how we want to describe our system – we did not talk about how these things are implemented. This mights sound odd. However, coping with complexity starts with finding solid means to describe what we want to developer – a good description is thus essential! Only then we want to use good platforms, that provide many of the (runtime) services we require, this can include J2EE CORBA Spring Osek …

151 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 151 - Code Generation Revisited II In case we have to build the infrastructure ourselves, e.g. since, for the respective target environment, no infrastructure is available (embedded, e.g.), we have a wide range of patterns to select from: POSA 1, 2 and 3 Server Component Patterns Remoting Patterns Good Luck THE END. Questions? Criticism?

152 i n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development of Distributed, Component-Based Systems - 152 - Some advertisement For those, who happen to speak (or rather, read) german: Völter, Stahl: Modellgetriebene Softwareentwicklung Technik, Engineering, Management dPunkt Verlag, 2005 www.mdsd-buch.de For all others: A translation (with Wiley) is under way.


Download ppt "I n g e n i e u r b ü r o f ü r s o f t w a r e t e c h n o l o g i e w w w. v o e l t e r. d e © 2 0 0 4 M a rk u s V ö l t e r. Model-Driven Development."

Similar presentations


Ads by Google