Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Assertion with.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

COMP 121 Week 9: AbstractList and ArrayList. Objectives List common operations and properties of Lists as distinct from Collections Extend the AbstractCollection.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
CS 206 Introduction to Computer Science II 09 / 05 / 2008 Instructor: Michael Eckmann.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Modularization.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extracting Code.
Software Engineering and Design Principles Chapter 1.
Confined Types Encapsulation and modularity Seminar November, 2005 presented by: Guy Gueta.
Principles of Object-Oriented Software Development Behavioral refinement.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Prototype of.
Chapter 1 Principles of Programming and Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
VB .NET Programming Fundamentals
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Measuring Copying.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Industrial Application.
Introduction SWE 619. Why Is Building Good Software Hard? Large software systems enormously complex  Millions of “moving parts” People expect software.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Debugging Support.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ICSE 2003 Java.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Criterion for.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Investigation.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A clone detection approach for a collection of similar.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University What Do Practitioners.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Programming Paradigms Procedural Functional Logic Object-Oriented.
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Design and Implementation.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Applying Clone.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan Pointcut-based Architectural Interface.
CET203 SOFTWARE DEVELOPMENT Session 1A Revision of Classes.
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Technology and Science, Osaka University Dependence-Cache.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University VerXCombo: An.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Retrieving Similar Code Fragments based on Identifier.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Investigation of Opportunities for Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University July 21, 2008WODA.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Code Clones.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Cage: A Keyword.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
02/14/2005 Introduction to Programming with Java, for Beginners Midterm 1 Review.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
CIS 842: Specification and Verification of Reactive Systems Lecture INTRO-Examples: Simple BIR-Lite Examples Copyright 2004, Matt Dwyer, John Hatcliff,
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Classification.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extraction of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Introduction to Objects and Encapsulation Computer Science 4 Mr. Gerb Reference: Objective: Understand Encapsulation and abstract data types.
Chapter 2 Principles of Programming and Software Engineering.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
David Evans CS201J: Engineering Software University of Virginia Computer Science Lecture 5: Implementing Data Abstractions.
ALLOY: A Formal Methods Tool Glenn Gordon Indiana University of Pennsylvania COSC 481- Formal Methods Dr. W. Oblitey 26 April 2005.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Software Ingredients:
Computer Science Victoria University of Wellington Copyright: david streader, Victoria University of Wellington Simple Design COMP
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Principles of Programming & Software Engineering
More JUnit CS 4501 / 6501 Software Testing
Microsoft Visual Basic 2005 BASICS
Department of Computer Science & Engineering, HITEC University, Taxila
Requirements Document
Research Activities of Software Engineering Lab in Osaka University
Presentation transcript:

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Assertion with Aspect (about Predictability) Takashi Ishio †, Toshihiro Kamiya ‡, Shinji Kusumoto † and Katsuro Inoue † † Osaka University ‡ Japan Science and Technology Agency {t-isio, kamiya, kusumoto,

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Introduction A programmer has assumptions for the usage or the purpose of a method. A programmer express such assumptions as assertion statements. Certain assumptions are hard to be described in OO programming. a context-specific assumption an assumption crosscutting objects

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Assertion with Aspect Combine assertion statements with aspects: In a class: assert(aPredicateMethod()); A predicate method returns a boolean value. In an aspect: boolean aPredicateMethod() { return... ; } Class assert(A1) Aspect Check a property of the component Check a context-specific property of the component assert(A2)

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Advantages of Assertion using Aspect Programmers can add a new constaint to an assertion statement. A reusable (generic) component + application-specific constraint aspects Aspects can add assertion statements checking pre/post-conditions to a class.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University How does assertion support predictability ? Assertion statements check the state of the program, do not modify the state. Programmers can understand what properties are held in the program execution. Pre/post-conditions express method functionalities.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University How does assertion reduce predictability ? An assertion may have a side effect. array = getUnsortedArray(); assert( isSorted (array) ); doSomethingUsingSortedArray(array); boolean isSorted (Array array) { if (!array.sorted()) array.sort(); return true; }

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University To be side-effect free assertion Assertion is an executable document for programmers. It is not a part of a function. How does we enforce programmers to implement the assertion without side-effects ? const keyword in C++ is hopeful.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Summary Writing assertion supports predictability when the programmers use assertion to express assumptions. An assertion with a side-effect is problematic. Enforcing programmers to write predicate methods without side-effects is important.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University

A context-specific assumption (A simple example) A programmer wants to use HashMap as a map from String which is length() > 0 to arbitrary Object. HashMap Object  Object is available. Following assertion is added to the program. before (Object o): within(AClass) && call(* HashMap.put(Object, Object)) && args(o,..) { assert ( (o instanceof String) && (((String)o).length() > 0) ); }

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Behavioral Subtyping A: HashMap (Object  Object) B: HashMap (String  Object) A is a behavioral subtype of B. (B is not a behavioral subtype of A) If B is a wrapper object, it needs to prohibit a direct access to A.

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Another example: control-flow assumption m: public method m1: private method, a worker method for m. “m1 is called from m.” before(): call(void m1()) && cflow(execution(void m())) { // set aCallerFlag about caller } before(): execution(void m1()) { assert ( aCallerFlag ) }