Introduction to Components and Specifications Using RESOLVE

Slides:



Advertisements
Similar presentations
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Advertisements

This research is funded in part the U. S. National Science Foundation grant CCR DEET for Component-Based Software Murali Sitaraman, Durga P. Gandi.
Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
INSE web pages u Please explore them! – – u EVERYONE: please follow the “ minilecture.
PVK-HT051 Contents Introduction Requirements Engineering Project Management Software Design Detailed Design and Coding Quality Assurance Software Maintenance.
Introduction to Formal Methods
1 Specifying Object Interfaces. 2 Major tasks in this stage: --are there any missing attributes or operations? --how can we reduce coupling, make interface.
Contents Introduction Requirements Engineering Project Management Software Design Detailed Design and Coding Quality Assurance.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Computer Science School of Computing Clemson University Mathematical Modeling Murali Sitaraman Clemson University.
Mathematics throughout the CS Curriculum Support by NSF #
Ranga Rodrigo. Class is central to object oriented programming.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Murali Sitaraman
Computer Science School of Computing Clemson University Specification and Reasoning in SE Projects Using a Web IDE Charles T. Cook (Clemson) Svetlana V.
Computer Science School of Computing Clemson University Mathematical Reasoning across the Curriculum Software Development Foundations and Software Engineering.
Class Specifications CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides are intended.
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.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
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.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Computer Science School of Computing Clemson University Discrete Math and Reasoning about Software Correctness Joseph E. Hollingsworth
CSE 222: Software Components in Engineering (SCE) – Introduction Instructor: Jimmy Voss Disclaimer: Not all material is original. Some is taken from the.
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.
Object-Oriented Principles Applications to Programming.
February 8, 2006copyright Thomas Pole , all rights reserved 1 Lecture 3: Reusable Software Packaging: Source Code and Text Chapter 2: Dealing.
Week 10: Loop Invariants, Code correctness Jimmy Voss Disclaimer: Some material may have been borrowed from both the Official Course slides as well as.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
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.
Design by Contract. The Goal Ensure the correctness of our software (correctness) Recover when it is not correct anyway (robustness) Correctness: Assertions.
Lecture 18 March 29, 2011 Formal Methods 3 CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Unit 1 - Introducing Abstract Data Type (ADT) Part 1.
CompSci 280 S Introduction to Software Development
Modular Alternatives to Testing
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Chapter 1: Introduction
Programming the Web Using Visual Studio .NET
Component Implementations Using RESOLVE
Formal Specification of Java Interfaces
Distribution and components
11.1 The Concept of Abstraction
About the Presentations
TIM 58 Chapter 8: Class and Method Design
Object orientation concepts
Design by Contract Fall 2016 Version.
Specifying Object Interfaces
Corresponds with Chapter 7
Introduction to Data Structures
Subprograms and Programmer Defined Data Type
Object Oriented Design Patterns - Structural Patterns
Programming Languages 2nd edition Tucker and Noonan
Programming paradigms
Formal Specification of Interfaces
Data Structures and Algorithms for Information Processing
Introduction to Components and Specifications Using RESOLVE
Mathematical Reasoning
ISpec: A Compositional Approach to Interface Specification
More Mathematical Reasoning (Conditional Statements)
Programming Languages and Paradigms
Mathematical Reasoning with Data Abstractions
Programming Languages 2nd edition Tucker and Noonan
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
11.1 The Concept of Abstraction
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

Introduction to Components and Specifications 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

Languages for Formal Specification ANNA (and SPARK) for Ada JML for Java Larch/C++ for C++ Spec# for C# … Eiffel RESOLVE VDM Z

Common Principles: Data Abstraction Specification Specifications are contracts Formal; unambiguous Mathematical logic Use a combination of well-known mathematical theories and notation Specify mathematical models for objects Specify the behavior of operations using those models

Example: Use of Mathematical Theories Concept Stack_Template(type Entry; …); uses String_Theory; Type Family Stack is modeled by … Operation Push… Operation Pop… … end Stack_Template;

Alternative Specification of Push Operation Operation Push_1 (restores E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <E> o #S; Note: Implementation needs to make a copy of the Entry E. This could be inefficient if entries are large.

Alternative Specification of Push Operation Operation Push_2 (clears E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <#E> o #S; Note: Implementation needs to “clear”, i.e., initialize the Entry E. …

Alternative Specification of Push Operation Operation Push (alters E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <#E> o #S; Note: Implementation may change Entry E in any way, so it permits the most efficient implementations; it is the most flexible specification

Clients have flexibility… Operation Push (alters E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <#E> o #S; Example code to do Push_1 (i.e., “restore” pushed entry): Copy(E, Temp); Push(Temp, S); Example code to do Push_2 (i.e., “clear” the pushed entry: Push(E, S); Clear(E);

Specification of Operations Operation Push (alters E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <#E> o #S; Operation Pop (replaces R: Entry; updates S: Stack); requires |S| > 0; ensures #S = <R> o S; Operation Depth (restores S: Stack): Integer; ensures Depth = |S|; …

Specification of Operations Operation Push (alters E: Entry; updates S: Stack); requires |S| < Max_Depth; ensures S = <#E> o #S; Operation Pop (replaces R: Entry; updates S: Stack); requires |S| > 0; ensures #S = <R> o S; Operation Depth (restores S: Stack): Integer; ensures Depth = |S|; …

Requires and Ensures clauses Requirements and guarantees Requires clauses are preconditions Ensures clauses are postconditions Who is responsible for requires clauses? Client (i.e., caller) Implementer Neither Both Discussion of consequences

Requires and Ensures clauses Requirements and guarantees Requires clauses are preconditions Ensures clauses are postconditions Who is responsible for requires clauses? Client (i.e., caller) Implementer Neither Both Discussion of consequences

Understanding specifications Please see the tutorials at the web interface under help on: String theory notations Understanding specification parameter modes Understanding details of specifications

Using Reusable Components Users (clients) need to know only interface specifications Users need to supply appropriate parameters to instantiate Depending on the paradigm, special operations are automatically available on objects Assignment in Java (e.g., S = T) Swap in RESOLVE (e.g., S :=: T)

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