Eiffel Programming Language - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Eiffel Programming Language

Description:

Eiffel Programming Language By David Riley and Jason Thorpe December 3, 2002 Eiffel Overview Object-oriented Motivation designed to avoid some of the pitfalls of ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 25
Provided by: ITSI
Category:

less

Transcript and Presenter's Notes

Title: Eiffel Programming Language


1
Eiffel Programming Language
  • By
  • David Riley and Jason Thorpe
  • December 3, 2002

2
Eiffel Overview
  • Object-oriented
  • Motivation designed to avoid some of the
    pitfalls of older OOP languages
  • Introduced in 1985
  • Created by Bertrand Meyer
  • Developed by his company Interactive Software
    Engineering
  • Named after Gustav Eiffel (designer of Eiffel
    Tower)
  • The Eiffel Tower was completed on time and
    within budget, which should happen if you use
    Eiffel for your software projects
    http//www.engin.umd.umich.edu/CIS/course.des
    /cis400/eiffel/eiffel.htmlhistory

3
Eiffel Milestones
  • 1985 Bertrand Meyer and Jean Marc Nerson begin
    development of Eiffel
  • 1986 1st Eiffel compiler presented (April), 1st
    Customer Deliveries (December)
  • 1987 Eiffel achieves commercial success
  • 1991 Non-profit International Consortium for
    Eiffel (NICE) is founded NICE controls the
    standardization of the Eiffel language
  • 1991 Publication of "Eiffel the language" by
    Bertrand Meyer (Prentice Hall)
  • 1995 NICE presents Eiffel Library Kernel
    Standard (ELKS), which sets standards for basic
    Eiffel classes.
  • 1997 NICE and the Eiffel Consortium organize
    Eiffel Struggle 97. Prizes awarded for Eiffel
    applications and Eiffel libraries.
  • http//www.halstenbach.de/eiffel/eiffel8.htm

4
Supporting Platforms
  • Eiffel Software's EiffelStudio environment is
    available for the major industry platforms
    Windows, Linux, Unix, and VMS.
  • These implementations are all source-code
    compatible.

5
Eiffel Compilers
  • ISE Eiffel v5.2
  • free time-limited evaluation version Windows and
    Unix
  • www.eiffel.com
  • SmartEiffel the GNU Eiffel compiler
  • Free All ANSI C machines
  • http//smarteiffel.loria.fr/
  • Iss-base
  • Commercial free 90-day trial version Windows
    and Unix
  • NonCommercial free Windows and Linux
  • http//www.halstenbach.com/
  • Visual Eiffel
  • Commercial free evaluation (limited features)
    Windows and Linux
  • http//www.object-tools.com/

6
Distinctive Features
  • Portable runs on many platforms
  • Open System has a C/C interface for code
    reusability
  • Melting Ice Technology combines compilation
    with byte code interpretation for faster
    turnaround times after a change has occurred.
  • Design by Contract enforced with assertions
    through invariance, preconditions and
    postconditions.
  • Automatic Documentation documentation produced
    quickly by single click.

7
Distinctive Features (cont.)
  • Multiple Inheritance - a class can inherit from
    multiple parents
  • Repeated Inheritance - a class inherits from
    another through two or more parents
  • Statically Typed catch errors at compile time
    not run time
  • Dynamically Bound guarantee of right operation
    being applied depending on target object

8
Areas of Application
  • Eiffel is not intended for any specific area but
    is used in
  • Teaching
  • not stuck within the confines of a single
    environment
  • Eiffel allows students to focus on the concepts,
    not notational details
  • Educators have remarked that it is easier to
    teach C, Smalltalk, or Java once Eiffel
    techniques are mastered.
  • Rapid Prototyping
  • covers analysis, design, and implementation in a
    single framework
  • Financial Applications

9
I/O in Eiffel
  • Attributes (Data)
  • last_characterCHARACTER
  • last_integerINTEGER
  • last_realREAL
  • last_stringSTRING
  • last_boolean BOOLEAN
  • Output routines
  • put_character(cCHARACTER)
  • put_integer(iINTEGER)
  • put_real(rREAL)
  • put_string(sSTRING)
  • put_boolean(bBOOLEAN)
  • put_new_line
  • Input routines
  • read_character
  • read_integer
  • read_real read_line -- result stored in
    last_string
  • read_word -- result stored in
    last_string
  • read_boolean

10
Basics in Eiffel
  • I/O example
  • io.put_string(Enter an Integer )
  • io.read_integer
  • int1 io.last_integer
  • Basic Data Types
  • INTEGER, CHARACTER, REAL, STRING, BOOLEAN
  • Comments (--)

11
Control Structures
  • Looping
  • from--initialization
  • until done -- BOOLEAN condition
  • loop-- executable statements
  • end
  • Example
  • from i 1
  • until i 10
  • loop
  • io.put_int (i) io.new_line i i 1
  • end

12
Control Structures
  • Conditional
  • ...
  • if x gt 10 then ... statements ...
  • elseif x gt 5 then ... elseif statements ...
  • elseif x gt 0 then ... more elseif statements ...
  • else ... else statements ...
  • end
  • Example
  • ..
  • if x gt 0 thenio.put_string(x is positive)
  • elseif x lt 0 thenio.put_string(x is negative)
  • elseio.put_string(x is 0)
  • end

13
Control Structures
  • Multi-Branch
  • inspect input_character
  • when 'y' then ... statements
  • when 'n' then ... statements
  • else ... if no match is found
  • end
  • Example
  • ...
  • State INTEGER
  • State_1, State_2, State_3 INTEGER is unique
  • ...
  • inspect State
  • when State_1 then some_action
  • when State_2 then some_other_action
  • when State_3 then another_action
  • else no_action
  • end

14
Arrays in Eiffel
  • Declaration
  • scores ARRAYINTEGER
  • Creation
  • !!scores.make(1,100)
  • Functions
  • count, lower, upper.
  • Insertion
  • scores.put(ltvaluegt, ltindexgt)
  • Access
  • scores.item(ltindexgt)

15
Design by Contract
  • class COUNTER
  • feature
  • count INTEGER
  • increment_by (inc INTEGER) is
  • require
  • inc gt 0
  • do
  • -- Implementation goes here
  • ensure
  • count old count inc
  • end
  • end

16
Hello World
  • class HELLO_WORLD creation make feature
    make is do print("Hello World!!!! N")
    end --make end -- class HELLO_WORLD

17
Hello World (cont.)
  • Class name - end (required)
  • Creation Clause specifies the routines that may
    be called.
  • Feature Clauses describes class features.

18
Type System
  • Strongly typed
  • Two categories reference type, expanded type
  • Five basic types (expanded) INTEGER, REAL,
    DOUBLE, CHARACTER and BOOLEAN

19
Sorting Example
  • class ARRAY_EXAMPLEcreation startfeature store
    ARRAYINTEGER
  • -- function fill_array fills array with
    integers entered from keyboard fill_array is
    local indexINTEGER do from index
    store.lower -1 until index store.upper
    loop index index 1
    io.readint store.put(io.lastint,index
    ) end -- loop end -- fill_array

20
Sorting Example (cont.)
  • -- function print array will print contents of
    array print_array is local indexINTEGER
    do from index store.lower-1 until
    index store.upper loop index
    index 1 io.putint(store.item(index))
    end -- loop end -- print_array

21
Sorting Example (cont.)
  • -- function sort array will sort the elements
    of the array sort_array is local sortedBOO
    LEAN temp_item INTEGER index, last
    INTEGER do from last store.upper
    sorted false until sorted or else last
    store.lower loop from sorted true
    index store.lower -1 last last-1
    until index last

22
Sorting Example (cont.)
  • loop index index 1
  • if store.item(index) gt store.item(index1)
    then -- swap element with successor
    element temp_item store.item(index1)
    store.put(store.item(index),index1)
    store.put(temp_item,index) sorted
    false end -- if end loop end --
    loop end -- sort_array

23
Sorting Example (cont.)
  • start is
  • do
  • !!store.make(1,7)
  • fill_array
  • sort_array
  • print_array
  • end -- start
  • end -- ARRAY-EXAMPLE

24
References
  • http//www.engin.umd.umich.edu/CIS/course.des/cis4
    00/eiffel/eiffel.htmlhistory
  • http//www.halstenbach.de/eiffel/eiffel8.htm
  • http//www.faqs.org/faqs/eiffel-faq/
  • http//www.pi.informatik.tu-darmstadt.de/inf1/eiff
    -ref/
Write a Comment
User Comments (0)
About PowerShow.com