Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Implementing Architectures Software Architecture
Foundations, Theory, and Practice Software Architecture 2 Objectives Concepts u Implementation as a mapping problem u Architecture implementation frameworks u Evaluating frameworks u Relationships between middleware, frameworks, component models u Building new frameworks u Concurrency and generative technologies u Ensuring architecture-to-implementation consistency Examples u Different frameworks for pipe-and-filter u Different frameworks for the C2 style Application u Implementing Lunar Lander in different frameworks
Foundations, Theory, and Practice Software Architecture 3 Objectives Concepts u Implementation as a mapping problem u Architecture implementation frameworks u Evaluating frameworks u Relationships between middleware, frameworks, component models u Building new frameworks u Concurrency and generative technologies u Ensuring architecture-to-implementation consistency Examples u Different frameworks for pipe-and-filter u Different frameworks for the C2 style Application u Implementing Lunar Lander in different frameworks
Foundations, Theory, and Practice Software Architecture 4 The Mapping Problem Implementation is the one phase of software engineering that is not optional Architecture-based development provides a unique twist on the classic problem u It becomes, in large measure, a mapping activity Maintaining mapping means ensuring that our architectural intent is reflected in our constructed systems Design Decisions Implementation Artifacts
Foundations, Theory, and Practice Software Architecture The Mapping Problem – More Specifically Components ? u classes, packages, modules, … Connectors ? u software buses, message services; what else? Interfaces ? u API signatures; what about protocols? Configurations ? u interfaces, function pointers, reflection Design rationale ? u comments, documentation Behavior ? u how do we translate FSP, StateCharts, Z, etc. to code? NFPs ? u indirectly via rationale, inspections, testing, user studies, … SWE 622 – Distributed Software Engineering © Malek,
Foundations, Theory, and Practice Software Architecture 6 Common Element Mapping Components and Connectors u Partitions of application computation and communication functionality u Modules, packages, libraries, classes, explicit components/connectors in middleware Interfaces u Programming-language level interfaces (e.g., APIs/function or method signatures) are common u State machines or protocols are harder to map
Foundations, Theory, and Practice Software Architecture 7 Common Element Mapping (cont’d) Configurations u Interconnections, references, or dependencies between functional partitions u May be implicit in the implementation u May be externally specified through a MIL and enabled through middleware u May involve use of reflection Design rationale u Often does not appear directly in implementation u Retained in comments and other documentation
Foundations, Theory, and Practice Software Architecture 8 Common Element Mapping (cont’d) Dynamic Properties (e.g., behavior): u Usually translate to algorithms of some sort u Mapping strategy depends on how the behaviors are specified and what translations are available u Some behavioral specifications are more useful for generating analyses or testing plans Non-Functional Properties u Extremely difficult to do since non-functional properties are abstract and implementations are concrete u Achieved through a combination of human-centric strategies like inspections, reviews, focus groups, user studies, beta testing, and so on
Foundations, Theory, and Practice Software Architecture 9 One-Way vs. Round Trip Mapping Architectures inevitably change after implementation begins u For maintenance purposes u Because of time pressures u Because of new information Implementations can be a source of new information u We learn more about the feasibility of our designs when we implement u We also learn how to optimize them Design Decisions Implementation Artifacts
Foundations, Theory, and Practice Software Architecture 10 One-Way vs. Round Trip Mapping (cont’d) Keeping the two in sync is a difficult technical and managerial problem u Places where strong mappings are not present are often the first to diverge One-way mappings are easier u Must be able to understand impact on implementation for an architectural design decision or change Two way mappings require more insight u Must understand how a change in the implementation impacts architecture-level design decisions
Foundations, Theory, and Practice Software Architecture 11 One-Way vs. Round Trip Mapping (cont’d) One strategy: limit changes u If all system changes must be done to the architecture first, only one-way mappings are needed u Works very well if many generative technologies in use u Often hard to control in practice; introduces process delays and limits implementer freedom Alternative: allow changes in either architecture or implementation u Requires round-trip mappings and maintenance strategies u Can be assisted (to a point) with automated tools
Foundations, Theory, and Practice Software Architecture 12 Architecture Implementation Frameworks Ideal approach: develop architecture based on a known style, select technologies that provide implementation support for each architectural element Design Decisions Database Software Library OO Class
Foundations, Theory, and Practice Software Architecture 13 Architecture Implementation Frameworks This is rarely easy or trivial u Few programming languages have explicit support for architecture-level constructs u Support infrastructure (libraries, operating systems, etc.) also has its own sets of concepts, metaphors, and rules To mitigate these mismatches, we leverage an architecture implementation framework
Foundations, Theory, and Practice Software Architecture 14 Architecture Implementation Frameworks Definition: An architecture implementation framework is a piece of software that acts as a bridge between a particular architectural style and a set of implementation technologies. It provides key elements of the architectural style in code, in a way that assists developers in implementing systems that conform to the prescriptions and constraints of the style. FrameworkFramework
Foundations, Theory, and Practice Software Architecture 15 Canonical Example The standard I/O (‘stdio’) framework in UNIX and other operating systems u Perhaps the most prevalent framework in use today u Style supported: pipe-and-filter u Implementation technologies supported: concurrent process-oriented operating system, (generally) non- concurrent language like C Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; ゥ 2008 John Wiley & Sons, Inc. Reprinted with permission.
Foundations, Theory, and Practice Software Architecture Another Example
Foundations, Theory, and Practice Software Architecture More Specifically
Foundations, Theory, and Practice Software Architecture Architecture - DEMO class DemoArch { static public void main(String argv[]) { Architecture arch = new Architecture (“DEMO”); // create components Component a = new Component (“A”); Component b = new Component (“B”); Component c = new Component (“C”); // create connectors Connector d = new Connector(“D”); // add components and connectors arch.addComponent(a); arch.addComponent(b); arch.addComponent(c); arch.addConnector(d); // establish the interconnections arch.attach(a, d); arch.attach(b, d); arch.attach(d, c); } } Architectural Structure Comp BComp A Comp C Connector D Comp AComp B Comp C
Foundations, Theory, and Practice Software Architecture Architecture - DEMO Component B handles the event and sends a response public void handle(Event e) { if (e.equals( “ Event_C ” )) {... Event e1= new Event( “ RSP_to_C ”, REPLY); e1.addParameter( “ response ”, resp); send(e1); }... } Send (e1) Architectural Interaction Component C sends an event Event e = new Event ( “ Event_C ”, REQUEST); e.addParameter( “ param_1", p1); send (e); Send (e) Comp BComp A Comp C Connector D