Component Implementations Using RESOLVE

Slides:



Advertisements
Similar presentations
This research is funded in part the U. S. National Science Foundation grant CCR DEET for Component-Based Software Murali Sitaraman, Durga P. Gandi.
Advertisements

Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer.
CHAPTER 6 Stacks Array Implementation. 2 Stacks A stack is a linear collection whose elements are added and removed from one end The last element to be.
Chapter 2 A Simple Compiler
Computer Science School of Computing Clemson University Mathematical Modeling Murali Sitaraman Clemson University.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Murali Sitaraman
Object Oriented Data Structures
CSCI-383 Object-Oriented Programming & Design Lecture 4.
Computer Science School of Computing Clemson University Mathematical Reasoning across the Curriculum Software Development Foundations and Software Engineering.
Chapter 3 Introduction to Collections – Stacks Modified
Lecture 16 March 22, 2011 Formal Methods CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Computer Science School of Computing Clemson University Introduction to Formal Specification Murali Sitaraman Clemson University.
Lecture 17 March 24, 2011 Formal Methods 2 CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
CSC 212 Stacks & Queues. Announcement Many programs not compiled before submission  Several could not be compiled  Several others not tested with javadoc.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
30 May Stacks (5.1) CSE 2011 Winter Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An.
This research is funded in part by grant CCR from the U. S. National Science Foundation. Profiles: A Compositional Mechanism for Performance Specification.
1 Performance Specifications Based upon Complete Profiles Joan Krone William F. Ogden Murali Sitaraman.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Fall 2008Programming Development Techniques 1 Topic 5 Data Abstraction Note: This represents a change in order. We are skipping to chapter 2 without finishing.
L13: Design by Contract Definition Reliability Correctness Pre- and post-condition Asserts and Exceptions Weak & Strong Conditions Class invariants Conditions.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Computer Science School of Computing Clemson University Mathematical Reasoning with Objects.
Integrating Math Units and Proof Checking for Specification and Verification SAVCBS Workshop 2008 SIGSOFT 2008 / FSE 16 November 9th, 2008 Hampton Smith.
Lecture 18 March 29, 2011 Formal Methods 3 CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
1 Data Structures CSCI 132, Spring 2016 Notes_ 5 Stacks.
CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 1 Abstract Data Types Motivation Abstract Data Types Example Using math. functions to describe.
Code: BCA302 Data Structures with C Prof.(Dr.) Monalisa Banerjee By.
Implementing Subprograms
Principles of programming languages 10: Object oriented languages
Sections 3.4 Formal Specification
Storage Classes There are three places in memory where data may be placed: In Data section declared with .data in assembly language in C - Static) On the.
EECE 310: Software Engineering
Modular Alternatives to Testing
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:
Stacks.
Formal Specification of Java Interfaces
11.1 The Concept of Abstraction
The Stack ADT. 3-2 Objectives Define a stack collection Use a stack to solve a problem Examine an array implementation of a stack.
Cinda Heeren / Geoffrey Tien
Chapter 8: Data Abstractions
CS212: Object Oriented Analysis and Design
CMPE 152: Compiler Design February 6 Class Meeting
CMSC 341 Lecture 10 B-Trees Based on slides from Dr. Katherine Gibson.
Abstraction Functions and Representation Invariants
Implementing Subprograms
GEOMATIKA UNIVERSITY COLLEGE CHAPTER 2 OPERATING SYSTEM PRINCIPLES
Introduction to Data Structures
Introduction to Components and Specifications Using RESOLVE
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Stacks.
Formal Specification of Interfaces
Iteration Abstraction
Parameter Passing Actual vs formal parameters
Data Structures and Algorithms for Information Processing
Stacks Abstract Data Types (ADTs) Stacks
Introduction to Components and Specifications Using RESOLVE
Mathematical Reasoning
Introduction to Data Structure
More Mathematical Reasoning (Conditional Statements)
File Organization.
Mathematical Reasoning with Data Abstractions
Computer Science 340 Software Design & Testing
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
Implementing Subprograms
8/23/
Presentation transcript:

Component Implementations Using RESOLVE Murali Sitaraman Clemson University

Overview Specifications provide user-oriented cover story Designs address efficiency and sufficient functional completeness issues Specifications hide implementation-specific information Multiple implementations may be developed to satisfy the same specification

Multiple Implementations Alternative implementations provide the same functionality Provide performance trade-offs time vs. space average case vs. worst case Efficiency vs. predictability some subset of methods vs. some others Users pick ones best fitting their requirements when instantiating

Common Principles: Data Abstraction Implementation Identify data representation (e.g., use of arrays or vectors to store Stack contents) Specify representation invariants Specify correspondence between representation and abstraction Write code for each operation to meet specifications

Example Data Representation public class Array_Realiz<Entry> implements Stack_Template<Entry> { private Entry contents[]; private int top; … // methods }

Example Data Representation Realization Array_Realiz for Stack_Template; Type Stack = Record Contents: Array (0..Max_Depth-1) of Entry; Top: Integer; end; … end Array_Realiz;

Which Code for Push is Right? Procedure Push(alters E: Entry; updates S: Stack); S.Top++; S.Contents(S.Top) :=: E; end Push; S.Top--;

Internal Contracts (Part 1) Convention or representation invariant All public methods (except constructors) may assume it at the beginning All public methods must guarantee it at the end Examples: Conventions 0 <= S.Top <= Max_Depth – 1; Conventions 1 <= S.Top <= Max_Depth; Which constructor (initialization) code is OK? S.Top := 0; S. Top := 1; S.Top := -1; S.Top := Max_Depth;

Internal Contracts (Part 2) Correspondence or abstraction relation Relationship between the internal representation and the conceptual (or abstract) model in the specification Holds when the conventions hold Examples: Correspondence Conceptual S = the entries in array S.Contents from 0 to S.Top -1 in reverse order Correspondence Conceptual S = the entries in array S.Contents from S.Top to Max_Depth -1 in the same order Which constructor (initialization) code is OK? S.Top := 0; S. Top := 1; S.Top := -1; S.Top := Max_Depth;

Internal Contracts Write initialization (constructor), push, and pop code that satisfy the following internal contract Conventions 0 <= S.Top <= Max_Depth – 1; Correspondence Conceptual S = the entries in array S.Contents from 0 to S.Top -1 in reverse order

Exercises and Questions Write code using different conventions and correspondence assertions Combine code for different methods from different people Does it work? Why or why not?