mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2026-02-08 03:24:44 +01:00
Author:admin
Date:2008-09-19T07:54:43.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@25 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[[Property:title|11 Agents]]
|
||||
[[Property:link_title|ET: Agents]]
|
||||
[[Property:weight|-3]]
|
||||
[[Property:uuid|ba49a80d-5ddf-8b30-4943-528974fd0ddd]]
|
||||
Our last mechanism, agents, adds one final level of expressive power to the framework describe so far. Agents apply object-oriented concepts to the modeling of operations.
|
||||
|
||||
==Objects for operations==
|
||||
|
||||
@@ -9,11 +9,11 @@ Eiffel directly implements the ideas of Design by Contract™ , which enhance
|
||||
A system -- a software system in particular, but the ideas are more general -- is made of a number of cooperating components. Design by Contract™ states that their cooperation should be based on precise specifications -- contracts -- describing each party's expectations and guarantees.
|
||||
|
||||
An Eiffel contract is similar to a real-life contract between two people or two companies, which it is convenient to express in the form of tables listing the expectations and guarantees. Here for example is how we could sketch the contract between a homeowner and the telephone company:
|
||||
{|
|
||||
{| border="1"
|
||||
|-
|
||||
| <code>provide_service</code>|| style="width=10%;"
|
||||
| '''OBLIGATIONS'''|| style="width=35%;"
|
||||
| '''BENEFITS'''|| style="width=35%;"
|
||||
| <code>provide_service</code>|| style="width=10%"
|
||||
| '''OBLIGATIONS'''|| style="width=35%"
|
||||
| '''BENEFITS'''|| style="width=35%"
|
||||
|-
|
||||
| '''Client'''
|
||||
| (Satisfy precondition:) <br/>
|
||||
@@ -93,7 +93,7 @@ The precondition of a routine expresses conditions that the routine is imposing
|
||||
The postcondition of a routine expresses what the routine guaranteed to its clients for calls satisfying the precondition. The notation <code> old expression </code>, valid in postconditions ( <code> ensure </code> clauses) only, denotes the value that <code> expression </code> had on entry to the routine.
|
||||
|
||||
The precondition and postcondition state the terms of the contract between the routine and its clients, similar to the earlier example of a human contract:
|
||||
{|
|
||||
{| border="1"
|
||||
|-
|
||||
| <code>deposit</code>|| style="width=10%;"
|
||||
| '''OBLIGATIONS'''|| style="width=35%;"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|6 The Dynamic Structure: Execution Model]]
|
||||
[[Property:link_title|ET: The Dynamic Structure: Execution Model]]
|
||||
[[Property:weight|-10]]
|
||||
[[Property:uuid|1f3f2707-9129-4dca-76c7-157143d7ae74]]
|
||||
A system with a certain static structure describes a set of possible executions. The run-time model governs the structure of the data ( <code> objects </code>) created during such executions.
|
||||
|
||||
The properties of the run-time model are not just of interest to implementers; they also involve concepts directly relevant to the needs of system modelers and analysts at the most abstract levels.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
[[Property:title|Eiffel Tutorial Copyright]]
|
||||
[[Property:link_title|ET: Eiffel Tutorial Copyright]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:uuid|105e9956-f168-b060-a6be-e78b221f269a]]
|
||||
====MANUAL IDENTIFICATION AND COPYRIGHT====
|
||||
|
||||
Title: An Eiffel Tutorial, Eiffel Software Technical Report TR-EI-66/TU.
|
||||
|
||||
Publication history
|
||||
|
||||
First published July 2001. Corresponds to release 5.0 of the EiffelStudio environment.
|
||||
|
||||
Author
|
||||
|
||||
Software credits
|
||||
|
||||
See acknowledgments in book <span> [http://www.eiffel.com/doc/page.html Eiffel: The Language] </span>.
|
||||
|
||||
Cover design
|
||||
|
||||
Rich Ayling.
|
||||
|
||||
Copyright notice and proprietary information
|
||||
|
||||
Copyright Interactive Software Engineering Inc. (Eiffel Software), 2001. May not be reproduced in any form (including electronic storage) without the written permission of Eiffel Software . "Eiffel Power" and the Eiffel Power logo are trademarks of Eiffel Software .
|
||||
|
||||
All uses of the product documented here are subject to the terms and conditions of the Eiffel Software Eiffel user license. Any other use or duplication is a violation of the applicable laws on copyright, trade secrets and intellectual property.
|
||||
|
||||
Special duplication permission for educational institutions
|
||||
|
||||
Degree-granting educational institutions using Eiffel Software Eiffel for teaching purposes as part of the <span> [http://www.eiffel.com/educators/resources.html Eiffel University Partnership Program] </span> may be permitted under certain conditions to copy specific parts of this book. Contact Eiffel Software for details.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|2 General Properties]]
|
||||
[[Property:link_title|ET: General Properties]]
|
||||
[[Property:weight|-14]]
|
||||
[[Property:uuid|1ad0b1d5-7ac6-9f55-92ec-ba6f42aee690]]
|
||||
Here is an overview of the facilities supported by Eiffel: <br/>
|
||||
* Completely ''object-oriented'' approach. Eiffel is a full-fledged application of object technology, not a "hybrid" of O-O and traditional concepts.
|
||||
* ''External interfaces''. Eiffel is a software composition tool and is easily interfaced with software written in such languages as C, C++, Java and C#.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|7 Genericity and Arrays]]
|
||||
[[Property:link_title|ET: Genericity and Arrays]]
|
||||
[[Property:weight|-9]]
|
||||
[[Property:uuid|7f3bd1d7-357e-031d-9faa-b00594aa9ae0]]
|
||||
Some of the classes that we will need, particularly in libraries, are '''container''' classes, describing data structures made of a number of objects of the same or similar types. Examples of containers include arrays, stacks and lists. The class <code> DEPOSIT_LIST </code> posited in earlier examples describes containers.
|
||||
|
||||
It is not hard, with the mechanisms seen so far, to write the class <code> DEPOSIT_LIST </code>, which would include such features as <code> count </code> (query returning the number of deposit objects in the list) and <code> put </code> (command to insert a new deposit object).
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|4 Hello World]]
|
||||
[[Property:link_title|ET: Hello World]]
|
||||
[[Property:weight|-12]]
|
||||
[[Property:uuid|5b286f94-dd63-1169-a64e-74b5f8c5ef14]]
|
||||
When discovering any approach to software construction, however ambitious its goals, it is reassuring to see first a small example of the big picture -- a complete program to print the famous "Hello World" string. Here is how to perform this fascinating task in the Eiffel notation.
|
||||
|
||||
You write a class <code> HELLO </code> with a single procedure, say <code> make </code>, also serving as creation procedure. If you like short texts, here is a minimal version:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|9 Inheritance]]
|
||||
[[Property:link_title|ET: Inheritance]]
|
||||
[[Property:weight|-7]]
|
||||
[[Property:uuid|c90e6ee3-b39d-48e5-2321-a34e12fd5327]]
|
||||
Inheritance is a powerful and attractive technique. A look at either the practice or literature shows, however, that it is not always well applied. Eiffel has made a particular effort to tame inheritance for the benefit of modelers and software developers. Many of the techniques are original with Eiffel. Paul Dubois has written (comp.lang.python Usenet newsgroup, 23 March 1997): there are two things that [Eiffel] got right that nobody else got right anywhere else: support for design by contract, and multiple inheritance. Everyone should understand these "correct answers" if only to understand how to work around the limitations in other languages.
|
||||
|
||||
==Basic inheritance structure==
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|13 To Learn More]]
|
||||
[[Property:link_title|ET: To Learn More]]
|
||||
[[Property:weight|-1]]
|
||||
[[Property:uuid|74a5c826-8f21-8cf2-4f2c-dee4ee28ead5]]
|
||||
Beyond this introduction, you will find the following two books essential to a mastery of the method and language: <br/>
|
||||
* <span> [http://eiffel.com/doc/oosc/ Object-Oriented Software Construction] </span>, Bertrand Meyer, Prentice Hall, 2nd edition 1997. (Make sure to get the second edition.) About object technology in general; presents the method behind Eiffel.
|
||||
* <span> [http://eiffel.com/doc/ Eiffel: The Language] </span>, Bertrand Meyer, Prentice Hall, 1992. Language manual and reference.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
[[Property:title|12 Lexical Conventions and Style Rules]]
|
||||
[[Property:link_title|ET: Lexical Conventions and Style Rules]]
|
||||
[[Property:weight|-2]]
|
||||
[[Property:uuid|60fdf029-8626-166d-cc4f-9069aacdda7f]]
|
||||
Eiffel software texts are free-format: distribution into lines is not semantically significant, and any number of successive space and line-return characters is equivalent to just one space. The style rules suggest indenting software texts as illustrated by the examples in this chapter.
|
||||
|
||||
Successive declarations or instructions may be separated by semicolons. Eiffel's syntax has been so designed, however, that (except in rare cases) '''the semicolon is optional'''. Omitting semicolons for elements appearing on separate lines lightens text and is the recommended practice since semicolons, as used by most programming languages, just obscure the text by distracting attention from the actual contents. Do use semicolons if you occasionally include successive elements on a single line.
|
||||
|
||||
63 names -- all unabbreviated single English words, except for <code> elseif </code> which is made of two words -- are reserved, meaning that you cannot use them to declare new entities. Here is the list:
|
||||
{|
|
||||
{| border="1"
|
||||
|-
|
||||
| <code>agent</code>
|
||||
| <code>alias</code>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|10 Other Mechanisms]]
|
||||
[[Property:link_title|ET: Other Mechanisms]]
|
||||
[[Property:weight|-4]]
|
||||
[[Property:uuid|c0a01664-194c-4e84-0517-8e7c1ca61dec]]
|
||||
We now examine a few important mechanisms that complement the preceding picture: shared objects; constants; instructions; and lexical conventions.
|
||||
|
||||
==Once routines and shared objects==
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|1 Overview]]
|
||||
[[Property:link_title|ET: Overview]]
|
||||
[[Property:weight|-15]]
|
||||
[[Property:uuid|0eaddff9-5d72-87fc-663a-2fc8a9152c25]]
|
||||
Eiffel is a method and language for the efficient description and development of quality systems.
|
||||
|
||||
As a language, Eiffel is more than a programming language. It covers not just programming in the restricted sense of implementation but the whole spectrum of software development: <br/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|3 The Software Process in Eiffel]]
|
||||
[[Property:link_title|ET: The Software Process in Eiffel]]
|
||||
[[Property:weight|-13]]
|
||||
[[Property:uuid|eef7f31a-25de-93cc-9a33-41d991c51ccb]]
|
||||
Eiffel, as noted, supports the entire lifecycle. The underlying view of the system development lifecycle is radically different not only from the traditional "Waterfall" model (implying a sequence of discrete steps, such as analysis, global design, detailed design, implementation, separated by major changes of method and notation) but also from its more recent variants such as the spiral model or "rapid prototyping", which remain predicated on a synchronous, full-product process, and retain the gaps between successive steps.
|
||||
|
||||
Clearly, not everyone using Eiffel will follow to the letter the principles outlined below; in fact, some highly competent and successful Eiffel developers may disagree with some of them and use a different process model. In the author's mind, however, these principles fit best with the language and the rest of the method, even if practical developments may fall short of applying their ideal form.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|5 The Static Picture: System Organization]]
|
||||
[[Property:link_title|ET: The Static Picture: System Organization]]
|
||||
[[Property:weight|-11]]
|
||||
[[Property:uuid|46d3f41e-d41c-a443-4574-403dfebb60aa]]
|
||||
We now look at the overall organization of Eiffel software.
|
||||
|
||||
References to Eiffel Software's libraries appearing in subsequent examples include: '''EiffelBase''', the fundamental open-source library covering data structures and algorithms; the '''kernel library''', a subset of EiffelBase covering the most basic notions such as arrays and strings; and '''EiffelVision 2''', an advanced graphics and GUI library providing full compatibility across platforms (Unix, Windows, OpenVMS) with native look-and-feel on each.
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
[[Property:link_title|Tutorial]]
|
||||
[[Property:weight|2]]
|
||||
[[Property:uuid|4dbc41e2-ecfc-8c50-9288-fce30f4abd90]]
|
||||
From this tutorial you should get a solid understanding of what Eiffel is all about and why it is different from other technologies. Still more detail is available in [http://www.eiffel.com/doc/oosc/ Object-oriented Software Construction, 2nd Edition].
|
||||
From this tutorial you should get a broad understanding of what Eiffel is all about and why it is different from other technologies. Still more detail is available in [http://www.eiffel.com/doc/oosc/ Object-oriented Software Construction, 2nd Edition].
|
||||
|
||||
|
||||
Reference in New Issue
Block a user