Eiffel Naeem Esfahani University of Tehran "Man cannot discover new oceans unless he has the courage to lose sight of the shore." -- Andre Gide.

Slides:



Advertisements
Similar presentations
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5.
Advertisements

Control Structures Ranga Rodrigo. Control Structures in Brief C++ or JavaEiffel if-elseif-elseif-else-end caseinspect for, while, do-whilefrom-until-loop-end.
Semantics Static semantics Dynamic semantics attribute grammars
Introduction to Programming in C++ John Galletly.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Exercise Session 1: Eiffel Introduction.
Overview of Previous Lesson(s) Over View  Front end analyzes a source program and creates an intermediate representation from which the back end generates.
Software Engineering and Design Principles Chapter 1.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 15: Exception handling.
VBA Modules, Functions, Variables, and Constants
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
1 Advanced Material The following slides contain advanced material and are optional.
Principles of Object-Oriented Software Development The language Eiffel.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 6: Object Creation.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 6: Object Creation.
Describing Syntax and Semantics
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.
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.
Ranga Rodrigo. Class is central to object oriented programming.
Chair of Software Engineering Beyond Eiffel these slides contain advanced material and are optional.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Lecture 22 Miscellaneous Topics 4 + Memory Allocation.
Analyzing the Requirements with Formal Specifications Vienna Development Method Specification Language (VDM-SL) Book: Formal Software Development From.
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Advanced Programming Collage of Information Technology University of Palestine, Gaza Prepared by: Mahmoud Rafeek Alfarra Lecture 2: Major Concepts of Programming.
Programming Language C++ Xulong Peng CSC415 Programming Languages.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Tammy Dahlgren with Tom Epperly, Scott Kohn, and Gary Kumfert Center for Applied Scientific Computing Common Component Architecture Working Group October.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
More About Classes Ranga Rodrigo. Information hiding. Copying objects.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session October 2008.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Chapter 12 Support for Object oriented Programming.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Chapter 3 Part II Describing Syntax and Semantics.
Topics AliasesSubprograms Generics & Configurations.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Topic 3: C Basics CSE 30: Computer Organization and Systems Programming Winter 2011 Prof. Ryan Kastner Dept. of Computer Science and Engineering University.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Object-Oriented Programming Chapter Chapter
CS305j Introduction to Computing Classes II 1 Topic 24 Classes Part II "Object-oriented programming as it emerged in Simula 67 allows software structure.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
C++ for Java Programmers Chapter 2. Fundamental Daty Types Timothy Budd.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Object-Oriented Design Concepts University of Sunderland.
Java-02 Basic Concepts Review concepts and examine how java handles them.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
CSC 520 – Advanced Object Oriented Programming, Fall, 2010 Thursday, September 30 Week 5, Generics and Inheritance Techniques, Meyer Ch. 10 & 16.
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Abstract Data Types and Encapsulation Concepts
Java Primer 1: Types, Classes and Operators
About the Presentations
Section 11.1 Class Variables and Methods
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Abstract Data Types and Encapsulation Concepts
Java Programming Language
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Presentation transcript:

Eiffel Naeem Esfahani University of Tehran "Man cannot discover new oceans unless he has the courage to lose sight of the shore." -- Andre Gide

I prefer to have as little as possible to do with Bertrand Meyer -- Bjarne Stroustrup, 1989

Overview Introduction & History Design By Contract™ Elements Concepts Syntax and Semantics

Introduction & History

Bertrand Meyer BS from Ecole polythecnique MS from Stanford University PhD from Univesite du Nancy Professor of Software Engineering at ETH in Zurich 2001

Bertrand Meyer Nine years in a large company Three years on the faculty at the University of California, Santa Barbara computer languages, object-oriented system design, architectural reviews, technology assessment

History Designed at Eiffel Software in 1985 as an internal tool A modern, OO environment integrating the concepts of modern software engineering There was simply nothing available

History First demonstrated in public at the first OOPSLA conference in October of 1986 Release it as a commercial product at the end of 1986 In 1988 in a book by Bertrand Meyer Version 2.3, released in the Summer of 1990

History Eiffel 3, was written entirely in Eiffel –Melting Ice Technology for fast recompilation –Fully graphical environment –Considerable advances in libraries –Optimization of the generated code The latest milestones is: Eiffel 5 and EiffelStudio

Application Leading to a set of successful industrial projects in the US, Canada, Europe and the Far East Adoption by numerous universities as the primary teaching language

Where the Name does come from? Homage to Gustave Eiffel, the man who built the eponymous Tower in Paris The Eiffel Tower was completed on time and within budget Small number of robust, elegant design patterns, combined and varied repeatedly to yield a powerful, efficient structure

Where the Name does come from? The Eiffel Tower was initially conceived as a temporary structure and it was able to endure far beyond its original goals What better symbol could there be of the engineering principles behind Eiffel?

Design By Contract™

Assertions A boolean expression that is evaluated when it is reached during execution If true, execution continues else, execution may halt or an exception Eiffel has support for writing assertion

Assertions Preconditions: When a routine is called Postconditions: When a routine returns General assertions: When execution reaches them Class invariants: Maintained by all instances of a class

Pre and postconditions Preconditions and postconditions are associated with routines of a class

Pre and postconditions The preconditions must be true when the routine is called Postconditions must have been established when the routine terminates

Class Invariant Conditions that must be true for all objects of the class at ‘stable’ times When method starts to execute: –Its preconditions are met and the class invariant is satisfied After execution: –The postcondition must be met and the class invariant must be satisfied

Class Invariant

Elements

Classes The basic and only construct in Eiffel The attributes of entities and the operations that entities can perform A class represents all objects of that type

Libraries Classes that frequently appear –Reuse EiffelBase: –INTEGER, REAL, STRING, LISTs, ARRAYs Libraries are not defined as part of the Eiffel language

Features Each class has a set of features which represent the attributes and routines of a class routines are either procedures or functions; attributes can be fields, constants or functions

Features Procedures (Commands) alter the state of the object Functions (Queries) are return an answer to a query about the state of an object This is by convention, rather than being enforced in Eiffel

Concepts

Inheritance Build new classes out of existing classes, and to reuse features already defined in those classes, you use inheritance Eiffel has multiple inheritance –solves clashing by having a rename clause –Redefinition Inheritance is one of the fundamental mechanisms for reuse Polymorphism

Class Syntax

Genericity You can reuse like inheritance Genericity is important in making programs type safe without resorting to type casts constrained genericity –allows generic parameters to be constrained allow you to write general algorithmic patterns

Objects A name in an Eiffel program is declared as having a type. The declaration x : T Still does not refer to any objects: x is not bound to an object Expressed as the object void. We can see if an object is bound to void by writing x=void Name x can be bound to any object that type conforms to type T

Objects Three ways to achieve this binding: Assignment instruction: The assignment x:=y binds x to the object to which y is currently bound A creation instruction: The creation instruction !!x creates a new object of type T,and binds x to it. This is similar to new in C++. Routine call

Objects c: C !! c.make An object of type C is created and attached to the reference c !D! c.make An object of type D, where D conforms to C is created and attached to c. If you have a creation routine declared for the class, the creation routine must be called like constructor

Objects Creation routines can be called as normal routines Note that the !! syntax is somewhat cryptic, and a recent change to the language has changed this for a create command keyword Eiffel has no delete operator. This is because, as with Java, Eiffel is garbage collected

Etc Class variables: variables which do not have one copy per class of objects. The Eiffel equivalent for doing this is once routines Eiffel does not have... –Gotos are not needed, as the Eiffel style is to write small routines –Global variables are a sign of poor structuring use once routines instead –Type casts to make up for a flawed type system –Pointers with their associated problems Code must be structured in classes

Syntax and Semantics

Some constructs Comments are introduced by -- Grouped entities are terminated by the keyword end, no begin keyword No semicolons, optionally be placed between instructions

Style Keywords are shown in bold User named entities in italic Class names are given in uppercase Eiffel is not case sensitive, so it is up to the programmer to follow style conventions. More than one words separate the constituent words with underscore ‘_’

Access specifiers Any set of features introduced by the feature keyword can be exported to other specific classes ANY and NONE There is no strict equivalent to private, as Eiffel believes it is not sensible to restrict visibility in subclasses.

Access specifiers

Basic Types BOOLEAN not, or, and, implies, or else, and then INTEGER +, -, *, //, \\, ˆ,, = REAL +, -, *, /, ˆ,, =

Conditional

Iterations There is only one form of iteration in Eiffel

Procedures

Functions The value to be returned result := expression

Redefinition

Renaming

Counter class COUNTER feature -- Access item: INTEGER -- Counter's value. feature -- Element change increment is -- Increase counter by one. do item := item + 1 end decrement is -- Decrease counter by one. do item := item - 1 end reset is -- Reset counter to zero. do item := 0 end end

Questions

If Time! Native C and C++ Simplicity First release instead prototype Melting ice