Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Exercise Session 1: Eiffel Introduction.

Slides:



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

Eiffel: Analysis, Design and Programming Bertrand Meyer (Nadia Polikarpova) Chair of Software Engineering.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Control Structures Ranga Rodrigo. Control Structures in Brief C++ or JavaEiffel if-elseif-elseif-else-end caseinspect for, while, do-whilefrom-until-loop-end.
Lab7: Introduction to Arduino
2 nd Microsoft Rotor Workshop, Pisa, April 23-25, SCOOPLI for.NET: a library for concurrent object-oriented programming Volkan Arslan, Piotr Nienaltowski.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session November 2008.
Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3.
Georgia Institute of Technology DrJava Appendix A Barb Ericson Georgia Institute of Technology May 2006.
Dr. Yang, Qingxiong (with slides borrowed from Dr. Yuen, Joe) LT4: Control Flow - Loop CS2311 Computer Programming.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 10: Project Presentation Ilinca.
Integrated Development Environments. Today We Will: Go over more advanced functionality of Eclipse. Break up into teams to work on presentation and final.
Chair of Software Engineering ATOT - Lecture 12, 12 May Advanced Topics in Object Technology Bertrand Meyer.
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 Exercise Session 2.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 3 29 September 2008.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session 1 22 September 2009.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 5: Project and EiffelStudio Presentation.
Chair of Software Engineering Avoid a void Bertrand Meyer ©Bertrand Meyer, 2008.
Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Lecture 9: Contracts and Inheritance (based on work with.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 14: Presentation of EiffelStudio.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
Chair of Software Engineering ATOT - Lecture 2, 2 April Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 6: Genericity.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chair of Software Engineering ATOT - Lecture 7, 23 April Advanced Topics in Object Technology Bertrand Meyer.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
Creating a Console Application with Visual Studio
Ranga Rodrigo. Class is central to object oriented programming.
A First Program Using C#
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 2.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Eiffel Naeem Esfahani University of Tehran "Man cannot discover new oceans unless he has the courage to lose sight of the shore." -- Andre Gide.
CPSC1301 Computer Science 1 Overview of Dr. Java.
Chapter 02 (Part III) Introduction to C++ Programming.
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Course Title: Introduction to C++ Course Instructor: ADEEL ANJUM Chapter No: 01 1 BY ADEEL ANJUM (MCS, CCNA,WEB DEVELOPER)
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session October 2008.
Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 9.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Loops (cont.). Loop Statements  while statement  do statement  for statement while ( condition ) statement; do { statement list; } while ( condition.
Counter-Controlled Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Chair of Software Engineering 1 Introduction to Programming Bertrand Meyer Exercise Session October 2008.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
An introduction to the debugger And jGrasp editor-syncrasies (ideosyncrasies)
National Diploma Unit 4 Introduction to Software Development Data Structures – Loops and selection.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
© Bertrand Meyer and Yishai Feldman Notice Some of the material is taken from Object-Oriented Software Construction, 2nd edition, by Bertrand Meyer (Prentice.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
14 Compilers, Interpreters and Debuggers
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Lecture Set 3 Introduction to Visual Basic Concepts
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Loops CIS 40 – Introduction to Programming in Python
Einführung in die Programmierung Introduction to Programming Prof. Dr
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Mu Editor – New User Cheat Sheet – CircuitPython Mode
Mu Editor – New User Cheat Sheet – CircuitPython Mode
Workshop for Programming And Systems Management Teachers
Presentation transcript:

Chair of Software Engineering Concurrent Object-Oriented Programming Prof. Dr. Bertrand Meyer Exercise Session 1: Eiffel Introduction

2 Overview Eiffel EiffelStudio

3 Eiffel: Classes class NUMERIC_COMPARABLE_VALUE_HOLDER inherit A B end Eiffel supports multiple inheritance. Potential name clashes can be resolved through feature adaption.

4 Eiffel: Features inherit... feature {APPLICATION, NUMERIC_COMPARABLE_VALUE_HOLDER} value: INTEGER assign set_value set_value (a_value: like value) do value := a_value end sum_of_values (a_value: like value): like value local l_value: like value do l_value := value + a_value Result := l_value end attribute with assigner procedure routine function routine export status: The default is ANY. Routines (procedures, functions) can have local variables. anchored type current object

5 Eiffel: Creation Procedures inherit... create {APPLICATION, NUMERIC_COMPARABLE_VALUE_HOLDER} set_value feature... list of procedure to be used as creation procedures export status: The default is ANY.

6 Eiffel: Further Instructions sum_of_value_holders (a_value_holder: like Current): like Current local l_value_holder: like Current do create l_value_holder.set_value (value + a_value_holder.value) Result := l_value_holder end creation assignment implicit result variable

7 Eiffel: Further Instructions multiplication_of_values (a_value: like value): like value local l_counter: like value do from Result := value.zero l_counter := value.zero until l_counter.is_equal (a_value) loop if a_value >= value.zero then Result := Result + value l_counter := l_counter + value.one else Result := Result - value l_counter := l_counter - value.one end loop initialization loop exit condition loop body

8 Eiffel: Contracts feature... set_value (a_value: like value) require value_is_not_zero: not a_value.is_equal (value.zero) do... ensure value_is_set: value = a_value end invariant value_is_not_zero: not value.is_equal (value.zero) precondition postcondition invariant

9 Eiffel: Genericity class NUMERIC_COMPARABLE_VALUE_HOLDER [T -> {NUMERIC rename is_equal as numeric_is_equal end, COMPARABLE}]... feature value: T assign set_value... end formal generic parameter the first constraint: T needs to conform to NUMERIC. is_equal gets renamed because COMPARABLE has a conflicting feature. the second constraint: T needs to conform to COMPARABLE. l_integer_value_holder: NUMERIC_COMPARABLE_VALUE_HOLDER[INTEGER] create l_integer_value_holder.set_value (1) actual generic parameter

10 Eiffel: Console I/O io.read_integer io.put_integer (io.last_integer) io.new_line Read an integer from the console and make it accessible through io.last_integer. Write an integer to the console. Start a new line on the console.

11 Eiffel: Deferred Classes and Features deferred class NUMERIC_COMPARABLE_VALUE_PRINTER [T -> {NUMERIC rename is_equal as numeric_is_equal end, COMPARABLE}] inherit NUMERIC_COMPARABLE_VALUE_HOLDER[T] feature print_value deferred end print_value_multiple_times (a_number: NATURAL) local l_counter: like a_number do from l_counter := a_number.zero until l_counter = a_number loop print_value io.put_new_line l_counter := l_counter + a_number.one end deferred feature deferred class A deferred class can have effective features which rely on deferred features.

12 Eiffel: Frozen and Expanded Classes frozen expanded class INTEGER inherit NUMERIC... COMPARABLE... feature... end frozen class expanded class

13 EiffelStudio EiffelStudio is an IDE for Eiffel. components editor context tool clusters pane features pane compiler project settings...

14 EiffelStudio: Writing Code syntax highlighting class name completion (SHIFT+CTRL+space) smart indenting block indent or exdent (TAB and SHIFT+TAB) block commenting or uncommenting (CTRL+K and SHIFT+CTRL+K) infinite level of undo/redo (reset after a save) quick search features (first CTRL+F to enter words then F3 and SHIFT+F3)

15 EiffelStudio: Compiling uses incremental compilation freezing: Generates C code from the whole system and then compiles it to machine code. This code is used during development. Initially the system is frozen. melting: Generates bytecode for the changed parts of the system. This is much faster than freezing. This code is used during development. finalizing: Creates an executable production version. Finalization performs extensive time and space optimizations.

16 EiffelStudio: Debugging The system must be melted/frozen (finalized systems cannot be debugged). Set / delete breakpoints. An efficient way of adding breakpoints consists in dropping a feature in the context tool. Run the program or step over / into the first statement. Pause or wait for a triggered breakpoint. Analyze the program. Use the object tool and the call stack pane. Run the program or step over / into the next statement. Stop the running program.

17 Resources international.org/publications/files/ECMA-ST/ECMA- 367.pdf international.org/publications/files/ECMA-ST/ECMA- 367.pdf