Architecture Implementation Techniques

Slides:



Advertisements
Similar presentations
Software Architecture Lecture 3
Advertisements

A component- and message-based architectural style for GUI software
Software Architecture Frameworks A Family of Implementations Nikunj Mehta Computer Science Department University of Southern California Los Angeles, CA.
Overview of Prism-MW CS 795 / SWE 699 Sam Malek Spring 2010.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Basic Concepts Software Architecture Lecture 3.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
CORBA - Common Object Request Broker Architecture.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors.
Implementing Software Architecture Software architecture is a set of principal design decisions; thus it is both: –Prescriptive: Gives “direction” on what.
Architecture-driven Modeling and Analysis By David Garlan and Bradley Schmerl Presented by Charita Feldman.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Implementing Architectures Software Architecture Lecture 15.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors Software Architecture Lecture 7.
1 Dynamic Assembly, Assessment, Assurance, and Adaptation via Heterogeneous Software Connectors Nenad Medvidovic with Marija Rakic and Barry Boehm University.
Introduction to the Class Project and Computing Facilities CSCI 599 – Software Engineering for Embedded Systems September 3, 2002.
1 Computer Systems & Architecture Lesson 1 1. The Architecture Business Cycle.
Architectural Design Establishing the overall structure of a software system Objectives To introduce architectural design and to discuss its importance.
HW2 INTRODUCTION CSCI-578 Spring Implicit Invocation  Indirectly or implicitly calls to methods and interfaces in response to an event or a received.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors Software Architecture Lecture 7.
Thammanoon Kawinfruangfukul CSSE MS, ID: Middleware.
Common Object Request Broker Architecture (CORBA) CS-328.
An Introduction to Software Architecture
Assessing the Suitability of UML for Modeling Software Architectures Nenad Medvidovic Computer Science Department University of Southern California Los.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Implementing Architectures Software Architecture.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 07. Review Architectural Representation – Using UML – Using ADL.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
A Style-Aware Architectural Middleware for Resource-Constrained, Distributed Systems CS 5381 Steven Ruiz Authors: Sam Malek, Marija Mikic-Rakic, and Nenad.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Implementing Architectures Software Architecture.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Architectural Styles Part II Software Architecture Lecture 6.
Modeling Component-based Software Systems with UML 2.0 George T. Edwards Jaiganesh Balasubramanian Arvind S. Krishna Vanderbilt University Nashville, TN.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Implementing Architectures Software Architecture Lecture 11.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. NFP Design Techniques Software Architecture Lecture 20.
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. NFP Design Techniques Software Architecture Lecture 20.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Implementation Chapter 6. Introduction Implementation one of the most important phase of software development, it can not be optional For better quality.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Software Connectors Acknowledgement: slides mostly from Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic,
Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved. Software Connectors in Practice Software Architecture.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
Implementation, Deployment and Mobility. ConceptsConcepts Concepts – Implementation as a mapping problem – Architecture implementation frameworks – Evaluating.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Chapter 15 – Software Reuse Chapter 15 Software reuse117/11/2014.
Software Architecture Lecture 3
Implementing Architectures
Software Architecture
Based on Eric Dashofy’s slides for
Implementing Architectures
Software Tools and Environments
CORBA Alegria Baquero.
Software Connectors.
Distribution and components
Software Quality Engineering
Software Architecture Lecture 3
Software Architecture Lecture 3
Interpreter Style Examples
CORBA Alegria Baquero.
Inventory of Distributed Computing Concepts
Software Architecture Lecture 20
Implementing Architectures
Implementing Architectures
Software Architecture Lecture 3
An Introduction to Software Architecture
Software Architecture Lecture 3
Implementing Architectures
Implementing Architectures
Implementing Architectures
Software Architecture Lecture 3
Overview of Embedded Software Research at USC
Presentation transcript:

Architecture Implementation Techniques Software Architecture

“Programming Your Architecture”

Architectural Structure 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); } Architecture - DEMO Comp A Comp B Connector D Comp C Comp A Comp B Comp C Connector D

Architectural Interaction Comp C sends an event Event e = new Event (“Event_C”, REQUEST); e.addParameter(“param_1", p1); B.handle(e); //Java allows it; violates framework send (e); //intended use of the framework Architecture - DEMO Comp A Comp B Comp B handles event and sends 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) Connector D Send (e) Comp C

More on Frameworks Frameworks are meant to assist developers in following a style But generally do not constrain developers from violating a style if they really want to Developing applications in a target style does not require a framework But if you follow good software engineering practices, you’ll probably end up developing one anyway Frameworks are generally considered as underlying infrastructure or substrates from an architectural perspective You won’t usually see the framework show up in an architectural model, e.g., as a component

Same Style, Different Frameworks For a given style, there is no one perfect architecture framework Different target implementation technologies induce different frameworks stdio vs. iostream vs. java.io Even in the same (style/target technology) groupings, different frameworks exist due to different qualitative properties of frameworks java.io vs. java.nio Various C2-style frameworks in Java

Evaluating Frameworks Can draw out some of the qualitative properties just mentioned Platform support Target language, operating system, other technologies Fidelity How much style-specific support is provided by the framework? Many frameworks are more general than one target style or focus on a subset of the style rules How much enforcement is provided?

Evaluating Frameworks (cont’d) Matching Assumptions Styles impose constraints on the target architecture/application Frameworks can induce constraints as well E.g., startup order, communication patterns … To what extent does the framework make too many (or too few) assumptions? Efficiency Frameworks pervade target applications and can potentially get involved in any interaction To what extent does the framework limit its slowdown and provide help to improve efficiency if possible (consider buffering in stdio)?

Evaluating Frameworks (cont’d) Other quality considerations Nearly every other software quality can affect framework evaluation and selection Size Cost Ease of use Reliability Robustness Availability of source code Portability Long-term maintainability and support

Middleware and Component Models This may all sound similar to various kinds of middleware/component frameworks CORBA, COM/DCOM, JavaBeans, .NET, Java Message Service (JMS), etc. They are closely related Both provide developers with services not available in the underlying OS/language CORBA provides well-defined interfaces, portability, remote procedure call… JavaBeans provides a standardized packaging framework (the bean) with new kinds of introspection and binding

Middleware and Component Models (cont’d) Indeed, architecture implementation frameworks are forms of middleware There’s a subtle difference in how they emerge and develop Middleware generally evolves based on a set of services that the developers want to have available E.g., CORBA: Support for language heterogeneity, network transparency, portability Frameworks generally evolve based on a particular architectural style that developers want to use Why is this important?

Middleware and Component Models (cont’d) By focusing on services, middleware developers often make other decisions that substantially impact architecture E.g., in supporting network transparency and language heterogeneity, CORBA uses RPC But is RPC necessary for these services or is it just an enabling technique? In a very real way, middleware induces an architectural style CORBA induces the ‘distributed objects’ style JMS induces a distributed implicit invocation style Understanding these implications is essential for not having major problems when the tail wags the dog!

Use the middleware as the basis for a framework Resolving Mismatches A style is chosen first, but the middleware selected for implementation does not support (or contradicts) that style A middleware is chosen first (or independently) and has undue influence on the architectural style used Strategies Change or adapt the style Change the middleware selected Develop glue code Leverage parts of the middleware and ignore others Hide the middleware in components/connectors Use the middleware as the basis for a framework

Hiding Middleware in Connectors Comp 1 Comp 1 Architecture (thread) Async Event RPC (thread) Implementation Comp 2 Comp 2

Building a New Framework Occasionally, you need a new framework The architectural style in use is novel The architectural style is not novel but it is being implemented on a platform for which no framework exists The architectural style is not novel and frameworks exist for the target platform, but the existing frameworks are inadequate Good framework development is extremely difficult Frameworks pervade nearly every aspect of your system Making changes to frameworks often means changing the entire system A task for experienced developers/architects

New Framework Guidelines Understand the target style first Enumerate all the rules and constraints in concrete terms Provide example design patterns and corner cases Limit the framework to the rules and constraints of the style Do not let a particular target application’s needs creep into the framework “Rule of three” for applications

New Framework Guidelines (cont’d) Choose the framework scope A framework does not necessarily have to implement all possible stylistic advantages (e.g., dynamism or distribution) Avoid over-engineering Don’t add capabilities simply because they are clever or “cool”, especially if known target applications won’t use them These often add complexity and reduce performance

New Framework Guidelines (cont’d) Limit overhead for application developers Every framework induces some overhead (classes must inherit from framework base classes, communication mechanisms limited) Try to put as little overhead as possible on framework users Develop strategies and patterns for legacy systems and components Almost every large application will need to include elements that were not built to work with a target framework Develop strategies for incorporating and wrapping these

Concurrency Concurrency is one of the most difficult concerns to address in implementation Introduction of subtle bugs: deadlock, race conditions… Another topic on which there are entire books written Concurrency is often an architecture-level concern Decisions can be made at the architectural level Done carefully, much concurrency management can be embedded into the architecture framework Consider our earlier example, or how pipe-and-filter architectures are made concurrent without direct user involvement

Generative Technologies With a sufficiently detailed architectural model, various implementation artifacts can be generated Entire system implementations Requires extremely detailed models including behavioral specifications More feasible in domain-specific contexts Skeletons or interfaces With detailed structure and interface specifications Compositions (e.g., glue code) With sufficient data about bindings between two elements

Maintaining Consistency Strategies for maintaining one-way or round-trip mappings Create and maintain traceability links from architectural implementation elements Explicit links in a database, in architectural models, in code comments can all help with consistency checking Make the architectural model part of the implementation When the model changes, the implementation adapts automatically May involve “internal generation” Generate some or all of the implementation from the architecture

Example Frameworks Intended for highly distributed and dynamic systems Many aspects shared with other styles explicit topological rules components connectors asynchronous messages Some unique aspects substrate independence context-reflective connector interfaces A Requests Notifications B C D

Framework Objectives Traceability Platform independence Distribution Dynamism Efficiency Observability Extensibility

Framework API Component Component(name : String) Component() Component(name : String, junk : String) send(r : Request) : void send(n : Notification) : void ComponentThread ComponentThread() ComponentThread(s : String) run() : void Connector Connector() Connector(name : String) handle(r : Request) : void handle(n : Notification) : void ConnectorThread ConnectorThread(n : String) Architecture Architecture() Architecture(name : String) Architecture(name : String, n : int) start() : void stop() : void shutdown() : void handle(r : Request) : void handle(n : Notification) : void addComponent(comp : Component) : void addConnector(conn : Connector) : void weld(conn : Connector, comp : Component) : void weld(comp : Component, conn : Connector) : void weld(conn1 : Connector, conn2 : Connector) : void removeComponent(comp : Component) : void removeConnector(conn : Connector) : void setThreadCount(n : int) : void getThreadCount() : int threadFunction() : void notifyArchitecture() : void searchFIFO(f : SynchronizedFIFO, o : Object) : Object Message Message() Message(name : String) name() : String addParameter(parameterName : String, parameterValue : Object) : void hasParameter(Name : String) : boolean removeParameter(Name : String) : void getParameter(Name : String) : Object Notification Notification() Notification(Name : String) Request Request() Request(Name : String)

Initial Framework Design – C2 Message Brick Request #belongs_to Notification inputBuffer outputBuffer IPort topComponents #bottom Port Component bottomComponents #top Connector Semaphor FIFOPort topOutFilterInclude[] #sem componentList #link #sem Architecture ConnectorThread ComponentThread connectorList

Evaluation of C2 Traceability Platform independence Distribution design decisions map to style elements, rules, and rationale Platform independence implemented in Java JVM, C, C++, and Ada Distribution encapsulated inside “border connectors” Dynamism leverages context-reflective connectors Efficiency 2000 SLOC; loads in under 5KB Observability only by tapping into port message queues Extensibility only via PL mechanisms (e.g., inheritance)

Framework Optimizations – oC2 Thread Pool Component A Component B handleRequest Connector C X R R N R R N 1 1 2 3 2 R send Request Component D

Evaluation of oC2 Traceability Platform independence Distribution faithful to the style’s structural, topological, and data aspects departure from the style’s behavioral and interaction aspects Platform independence implemented in Java JVM, J2ME, and EVC++ Distribution encapsulated inside “border connectors” Dynamism leverages context-reflective connectors central message queue improves control over dynamic change Efficiency 1800 SLOC; loads in under 1.5KB Observability hampered by the centralized message queue Extensibility

Framework Extensibility – xC2 ArchitectureEventConstants ConnectorThread IConnector ComponentThread #bottom #top Connector Architecture IComponent Component IArchitecture Serializable Brick Message Address +topId +bottomId Request Notification IScaffold

Evaluation of xC2 Traceability Platform independence Distribution departure from the style in implementing all of its key aspects extensive use of OO interfaces Platform independence implemented in Java JVM, J2ME, EVC++, and Python Distribution encapsulated inside “border connectors” Dynamism leverages context-reflective connectors central message queue improves control over dynamic change supports component mobility Efficiency 1500 SLOC; loads in under 2.5KB Observability facilitated by IScaffold interfaces Extensibility IScaffold remove thread management from Architecture symmetric treatment of components and connectors

Evaluation Shared API Implementations in numerous PLs Communication across PL implementations Hundreds of applications built to date Allow integration of non-C2 compliant components Two benchmarking applications 1 component above 1 below 50 components above 1 below 100,000 messages Intel Pentium III 500MHz, 256MB, JDK 1.4 beta 2, Windows 2000 *

Android

Architectural Principles Implicit in / imposed by Android’s Application Framework Architecture building blocks Hierarchical decomposition Architectural styles Architecture models Implementation and deployment Support for NFPs

Architecture Building Blocks Components Activity – UI screen-level component Fragment – module handling events for specific UI portion Service – background processing Content Provider – storage and retrieval Broadcast receiver – message router Connectors Explicit Message-Based – Intent via explicit recipient Implicit Message-Based – Intent via Intent Filter Data Access – Content Resolver RPC – direct method invocation using IDL stubs Configuration XML Manifest

Hierarchical Decomposition Top-level Set of apps App-level Set of activities, services, etc. Activity-level Set of fragments

Architectural Styles Message-based implicit invocation Message-based explicit invocation Publish-subscribe Shared state Distributed objects

Implementation Android Development Framework (ADF) Provides base classes that are extended with app-specific logic Activity lifecycle Android Runtime Environment (ART) Provides implementation of Android’s connectors

Example Android App – K-9 Mail

K-9 Mail App’s Architecture The app runs in its own “sandbox”