Component Based Software Engineering

Slides:



Advertisements
Similar presentations
Chapter 13 Abstraction and inheritance. This chapter discusses n Implementing abstraction. u extension u inheritance n Polymorphism/dynamic binding. n.
Advertisements

Building Bug-Free O-O Software: An Introduction to Design By Contract A presentation about Design By Contract and the Eiffel software development tool.
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Component Oriented Programming 1 Chapter 2 Theory of Components.
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Giving a formal meaning to “Specialization” In these note we try to give a formal meaning to specifications, implementations, their comparisons. We define.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM B. Bershad, S. Savage, P. Pardyak, E. G. Sirer, D. Becker, M. Fiuczynski, C. Chambers,
C12, Polymorphism “many forms” (greek: poly = many, morphos = form)
1 Inheritance. 2 One class inherits from another if it describes a specialized subset of objects Terminology: inheritschild class subclass –the class.
Software Testing and Quality Assurance
Page 1 Building Reliable Component-based Systems Chapter 2 -Specification of Software Components Chapter 2 Specification of Software Components.
ISBN Chapter 9 Subprograms. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Introduction Two fundamental abstraction facilities.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Polymorphism Chapter six of: Szyperski, Clemens et al. Component Software - Beyond Object-Oriented Programming. Second Edition.
Page 1 Building Reliable Component-based Systems Chapter 6 - Semantic Integrity in Component Based Development Chapter 6 Semantic Integrity in Component.
Comparison of OO Programming Languages © Jason Voegele, 2003.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
Contracts for Concurrency - Contracts & Inheritance Aryabrata Basu University of Georgia.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
Cs205: engineering software university of virginia fall 2006 David Evans Substitution Principle.
Chapter 3 - Language Design Principles
Object-Oriented Programming Chapter Chapter
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
Object Oriented Programming
ISBN Object-Oriented Programming Chapter Chapter
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
What’s Ahead for Embedded Software? (Wed) Gilsoo Kim
CSCI-383 Object-Oriented Programming & Design Lecture 24.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Object-Oriented Design Concepts University of Sunderland.
Cs2220: Engineering Software Class 12: Substitution Principle Fall 2010 University of Virginia David Evans.
Types and Programming Languages Lecture 10 Simon Gay Department of Computing Science University of Glasgow 2006/07.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
CSCE 240 – Intro to Software Engineering Lecture 3.
CSC 520 – Advanced Object Oriented Programming, Fall, 2010 Thursday, September 30 Week 5, Generics and Inheritance Techniques, Meyer Ch. 10 & 16.
CSCI 383 Object-Oriented Programming & Design Lecture 22 Martin van Bommel.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Component-Based Software Engineering Components and Interfaces Paul Krause and Sotiris Moschoyiannis.
Page 1, CBSE – graduate course Specification of Software Components Frank Lüders Mälardalen University, Dept. of Computer Engineering
Data Abstraction: The Walls
Jim Fawcett CSE775 – Distributed Objects Spring 2017
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Semantic Analysis Type Checking
Chapter 11 Object-Oriented Design
Java Programming Language
Introducing Java Generics and Collections
Topics: jGRASP editor ideosyncrasies assert debugger.
About the Presentations
CSE 331 Subtyping slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
Real-time Software Design
Interfaces and Inheritance
Applied Software Implementation & Testing
CSCI 3370: Principles of Programming Languages Chapter 9 Subprograms
Packages and Interfaces
Component--based development
Generic programming in Java
More Object-Oriented Programming
619 Final Review Last updated Spring 2010 © : Paul Ammann.
Chapter 17 - Component-based software engineering
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Lecture 13: Subtyping Rules Killer Bear Climber
Drew Wyborski Programming Languages
Presentation transcript:

Component Based Software Engineering Chapter 6 Polymorphism

Polymorphism  Many Shapes The ability to appear in multiple shapes, depending on context

Substitutability Self-standing contractually specified interfaces decouple client and providers Interfaces must be specified carefully, not requiring too much or too little Preconditions, postconditions Clients may establish more than required by preconditions Providers may establish more than required by postconditions

Pre- and postconditions Established by certain client  demanded by interface = Precondition  required by certain provider Established by certain provider  guaranteed by interface = Postcondition  expected by certain client

Implementation of an interface an implementation of an interface may have a more relaxed precondition and a strengthened postcondition, but: prec. interface  prec. implementation postc. implementation  postc. interface Clients based on the interface contract will not benefit from changes implementations can be substituted if they satisfy the same contract.

Types, Subtypes and Type Checking Checking if all contracts are satisfied is not feasible Type checking is feasible Type names all operations on an interface number and types of parameters type of returned values

Subtypes Objects may implement more than the required interface implement multiple interfaces extended version of required interface legal because: client expecting a certain type expects an object fulfilling a certain contract structural subtyping: instead of naming a base class, repeat all operations

Subtypes continued Postconditions may be stronger output parameters & return types can be subtypes of the types laid down in contract Covariance Preconditions may be weaker input parameters can be replaced by supertypes of types laid down in contract Contravariance Input/Output variables cannot change! Invariance

Object languages and types No explicit type system only run-time checking examples: Smalltalk, Python Explicit type system static type checking narrowing cast checking at run-time examples: Java, Component Pascal Few languages support co- or contravariant changing of types when forming subtypes

Types, interfaces & components Self-standing interfaces have to be fully and explicitly typed to benefit from type checking Some languages use structural subtyping can be dangerous, because this only relies on operations and type system, not full contract but, mostly small chance of actual accidental structural subtyping, except for small interfaces.

Multiple interfaces Components can support multiple interfaces COM IDL: sets of interfaces called categories useful for testing if a component provides all required interfaces In Java, C#, Object Pascal, objects can implement multiple interfaces Java can mimmick categories by letting objects implement an interface that extends all required interfaces

Independent extensibility a system is independently extensible if it is extensible and independently developed extensions can be combined example: Operating Systems can load and execute applications WWW-Browsers: plug-ins Micro-kernels → Components everywhere!

Efficiency Most real micro-kernels fail, because of lack of efficiency: Too many context switches Same problem with component systems with a lot of communication between components Solution: carefully choose granularity of components so most interactions stay within component boundaries

Safety by construction Type-safe systems example Java automatic memory management (garbage collection) run-time checks on dangerous operations (array bounds checking) recheck static properties when loading non-local class files

Module safety Components specify which services they require They are not allowed to access any other services (security manager) Some languages do not offer module safety, but do offer class safety

Safety in multilanguage environment a strong Interface Definition Language can provide safety features for multiple languages This often limits languages to a safe subset components with unsafe methods can be rejected if they do not have the right credentials

Safety, security & trust Very few languages are formally proven to be correct if proven: implementation can still break correct properties Trust in safety and security is mostly sociological and can be earned: UNIX security mechanism Java security strategies

Dimensions of independent extensibility Traditional class frameworks are frozen at construction time In independently extensible frameworks extensions from independent sources can be combined Each feature that can be extended is called a dimension of extensibility Dimensions are not always orthogonal Extension space should be complete

Bottleneck interfaces & Singleton configurations Bottleneck interfaces: Fixed interfaces for interactions between indepently extended abstractions Singleton configurations: Exactly one component extends a dimension

Parallel, orthogonal and recursive extensions Parallel: Same dimension. Sometimes needs to be arbitrated if multiple extensions use the same necessarily unique resource Orthogonal: Different dimensions. Needs bottleneck interfaces for interaction Recursive: Introduce a new component framework

Evolution & immutability of interfaces & contracts Contracts cannot be changed at will. Providers can stop providing an interface Changes to contracts: to interface: syntactic change to specification: semantic change Contracts can expire Contracts can be overridden be newer contracts

Other forms of polymorphism Overloading: same name for unrelated operations Parametric: Same implementation serves a variety of types (C++ templates) Bounded: Mix between subtype and parametric polymorphism, where there can be restrictions on which types can be used