1 / 24

Eiffel Programming Language

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 older OOP languages Introduced in 1985 Created by Bertrand Meyer Developed by his company Interactive Software Engineering

jorryn
Download Presentation

Eiffel Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.html#history

  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. Attributes (Data) last_character:CHARACTER last_integer:INTEGER last_real:REAL last_string:STRING last_boolean :BOOLEAN Output routines put_character(c:CHARACTER) put_integer(i:INTEGER) put_real(r:REAL) put_string(s:STRING) put_boolean(b:BOOLEAN) 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 I/O in Eiffel

  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. 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 Control Structures

  12. Conditional ... if x > 10 then ... statements ... elseif x > 5 then ... elseif statements ... elseif x > 0 then ... more elseif statements ... else ... else statements ... end Example .. if x > 0 thenio.put_string(“x is positive”); elseif x < 0 thenio.put_string(“x is negative”); elseio.put_string(“x is 0”); end Control Structures

  13. 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; Control Structures

  14. Arrays in Eiffel • Declaration • scores :ARRAY[INTEGER]; • Creation • !!scores.make(1,100) • Functions • count, lower, upper. • Insertion • scores.put(<value>, <index>); • Access • scores.item(<index>);

  15. Design by Contract class COUNTER feature count: INTEGER increment_by (inc: INTEGER) is require inc > 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:ARRAY[INTEGER]; -- function fill_array fills array with integers entered from keyboard fill_array is local index:INTEGER; 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 index:INTEGER; 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 sorted:BOOLEAN; 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) > store.item(index+1) then -- swap element with successor element temp_item := store.item(index+1); store.put(store.item(index),index+1); 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/cis400/eiffel/eiffel.html#history • http://www.halstenbach.de/eiffel/eiffel8.htm • http://www.faqs.org/faqs/eiffel-faq/ • http://www.pi.informatik.tu-darmstadt.de/inf1/eiff-ref/

More Related