mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 23:02:28 +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|12 Combining Genericity and Inheritance]]
|
||||
[[Property:link_title|I2E: Combining Genericity and Inheritance]]
|
||||
[[Property:weight|-3]]
|
||||
[[Property:uuid|912e4c38-9add-e478-59c3-5c10aa75d784]]
|
||||
Genericity and inheritance, the two fundamental mechanisms for generalizing classes, may be combined in two fruitful ways.
|
||||
|
||||
The first technique yields '''polymorphic data structures'''. Assume that in the generic class <code> LIST [ G ] </code> the insertion procedure <code> put </code> has a formal argument of type <code> G </code>, representing the element to be inserted. Then with a declaration such as
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|13 Deferred Classes and Seamless Development]]
|
||||
[[Property:link_title|I2E: Deferred Classes and Seamless Development]]
|
||||
[[Property:weight|-2]]
|
||||
[[Property:uuid|b3264238-f160-a6fc-0b03-adcd80b1f55a]]
|
||||
The inheritance mechanism includes one more major notion: deferred features and classes.
|
||||
|
||||
Declaring a feature <code> f </code> as deferred in a class <code> C </code> expresses that there is no default implementation of <code> f </code> in <code> C </code>; such implementations will appear in eventual descendants of <code> C </code>. A class that has one or more deferred routines is itself said to be deferred. A non-deferred routine or class -- like all those seen until now -- is said to be '''effective'''.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|6 Design by Contract and Assertions]]
|
||||
[[Property:link_title|I2E: Design by Contract and Assertions]]
|
||||
[[Property:weight|-9]]
|
||||
[[Property:uuid|f563aa75-3a5a-5110-b4f1-07da5448f668]]
|
||||
If classes are to deserve their definition as abstract data type implementations, they must be known not just by the available operations, but also by the formal properties of these operations, which did not yet appear in the preceding example.
|
||||
|
||||
==The role of assertions==
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|2 Design Principles]]
|
||||
[[Property:link_title|I2E: Design Principles]]
|
||||
[[Property:weight|-13]]
|
||||
[[Property:uuid|529659bd-ec13-5805-87f2-2fd9318ad442]]
|
||||
The aim of Eiffel is to help specify, design, implement and modify quality software. This goal of quality in software is a combination of many factors; the language design concentrated on the three factors which, in the current state of the industry, are in direct need of improvements: reusability, extendibility and reliability. Also important were other factors such as efficiency, openness and portability.
|
||||
|
||||
'''Reusability''' is the ability to produce components that may serve in many different applications. Central to the Eiffel approach is the presence of predefined libraries such as EiffelBase, and the language's support for the production of new libraries.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|8 Event-Driven Programming and Agents]]
|
||||
[[Property:link_title|I2E: Event-Driven Programming and Agents]]
|
||||
[[Property:weight|-7]]
|
||||
[[Property:uuid|16fdab60-ae42-1bb8-f4bb-89e34d18a842]]
|
||||
The division of roles in object technology is clear: of the two principal constituents of a system, object types and operations, the first dominates. Classes, representing object types, determines the structure of the software; every routine, representing an operations, belongs to a class.
|
||||
|
||||
In some circumstances it is useful to define an object that denotes an operation. This is especially useful if you want to build an object structure that refers to operations, so that you can later traverse the structure and execute the operations encountered. A typical application is '''event-driven programming''' for Graphical User Interfaces (GUI), including Web programming. In GUI programming you will want to record properties of the form
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|7 Exceptions]]
|
||||
[[Property:link_title|I2E: Exceptions]]
|
||||
[[Property:weight|-8]]
|
||||
[[Property:uuid|e3e10dac-0dd7-bbe1-240c-6a6985c7376a]]
|
||||
Whenever there is a contract, the risk exists that someone will break it. This is where exceptions come in.
|
||||
|
||||
Exceptions -- contract violations -- may arise from several causes. One is an assertion violation, if you've selected run-time assertion monitoring. Another is a signal triggered by the hardware or operating system to indicate an abnormal condition such as arithmetic overflow, or an attempt to create a new object when there's not enough memory available.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|9 Genericity]]
|
||||
[[Property:link_title|I2E: Genericity]]
|
||||
[[Property:weight|-6]]
|
||||
[[Property:uuid|091c0b65-73de-b454-b3f2-d8752983780e]]
|
||||
Building software components (classes) as implementations of abstract data types yields systems with a solid architecture but does not in itself ensure reusability and extendibility. Two key techniques address the problem: generosity (unconstrained or constrained) and inheritance. Let us look first at the unconstrained form.
|
||||
|
||||
To make a class generic is to give it '''formal generic parameters''' representing as unknown types, as in these examples from EiffelBase, an open-source library covering basic data structures and algorithms:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|10 Inheritance]]
|
||||
[[Property:link_title|I2E: Inheritance]]
|
||||
[[Property:weight|-5]]
|
||||
[[Property:uuid|acf84989-0e7c-f2f7-427a-19e7fce404ce]]
|
||||
Inheritance, the other fundamental generalization mechanism, makes it possible to define a new class by combination and specialization of existing classes rather than from scratch.
|
||||
|
||||
The following simple example, from the Data Structure Library in EiffelBase, is typical. <code> LIST </code>, as noted, describes lists in any representation. One such representation if the lists have a fixed number of elements uses an array. We may define the corresponding class by combination of <code> LIST </code> and <code> ARRAY </code>, as follows:
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
[[Property:title|Invitation to Eiffel Copyright]]
|
||||
[[Property:link_title|I2E: Invitation to Eiffel Copyright]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:uuid|ce7b4af4-b669-9fec-92e1-c24c4f089336]]
|
||||
Title: Invitation to Eiffel, Eiffel Software Technical Report TR-EI-67/IV.
|
||||
|
||||
==Publication history==
|
||||
First published 1987. Some revisions (in particular Web versions) have used the title "Eiffel in a Nutshell" <br/>
|
||||
This version: July 2001. Introduces coverage of agents; several other improvements. Corresponds to release 5.0 of the EiffelStudio environment.
|
||||
==Author==
|
||||
Bertrand Meyer
|
||||
==Software Credits==
|
||||
See acknowledgments in book [http://www.eiffel.com/doc/page.html Eiffel: The Language] .
|
||||
==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 [http://www.eiffel.com/educators/resources.html Eiffel University Partnership Program] may be permitted under certain conditions to copy specific parts of this book. Contact Eiffel Software for details.
|
||||
{{info|About Eiffel Software (Interactive Software Engineering) helps you produce software better, faster and cheaper. Eiffel Software provides a wide range of products and services based on object technology, including Eiffel Software Eiffel, a complete development environment for the full system life cycle. Eiffel Software's training courses, available worldwide, cover key management and technical topics. Eiffel Software's consultants are available to address your project needs at all levels. Eiffel Software's TOOLS (Technology of Object-Oriented Languages and Systems) conferences, [http://www.tools-conferences.com http://www.tools-conferences.com] , are the meeting point for anyone interested in the software technologies of the future. Eiffel Software originated one of the earliest . NET products and offers a full range of . NET services and training at [http://www.dotnetexperts.com http://www.dotnetexperts.com] . }}
|
||||
|
||||
==For more information==
|
||||
Interactive Software Engineering Inc. <br/>
|
||||
Eiffel Software Building, <br/>
|
||||
356 Storke Road, <br/>
|
||||
Goleta, <br/>
|
||||
CA, 93117 <br/>
|
||||
USA. <br/>
|
||||
<br/>
|
||||
Telephone 805-685-1006, <br/>
|
||||
Fax 805-685-6869
|
||||
==Internet and email==
|
||||
Eiffel Software maintains a rich source of information at [http://eiffel.com http://eiffel.com] , with more than 1200 Web pages including online documentation, downloadable files, product descriptions, links to Eiffel Software partners, University Partnership program, mailing list archives, announcements, press coverage, Frequently Asked Questions, Support pages, and much more. Visit [http://www.eiffel.com/general/contact_details.html http://www.eiffel.com/general/contact_details.html] to request information about products and services. To subscribe to the Eiffel Software Eiffel user list, go to [http://groups.eiffel.com/join http://groups.eiffel.com/join] .
|
||||
==Support programs==
|
||||
Eiffel Software offers a variety of support options tailored to the diverse needs of its customers. See [http://support.eiffel.com http://support.eiffel.com] for details.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|3 Object-Oriented Design]]
|
||||
[[Property:link_title|I2E: Object-Oriented Design]]
|
||||
[[Property:weight|-12]]
|
||||
[[Property:uuid|e0a1f24e-5dd7-e5f8-8be8-8da32cc6a91c]]
|
||||
To achieve reusability, extendibility and reliability, the principles of object-oriented design provide the best known technical answer.
|
||||
|
||||
An in-depth discussion of these principles fall beyond the scope of this introduction but here is a short definition:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|11 Polymorphism and Dynamic Binding]]
|
||||
[[Property:link_title|I2E: Polymorphism and Dynamic Binding]]
|
||||
[[Property:weight|-4]]
|
||||
[[Property:uuid|1c3221be-0237-1c9a-407d-652a4084de12]]
|
||||
Inheritance is not just a module combination and enrichment mechanism. It also enables the definition of flexible entities that may become attached to objects of various forms at run time, a property known as polymorphism.
|
||||
|
||||
This remarkable facility must be reconciled with static typing. The language convention is simple: an assignment of the form <code> a </code> <code> : </code> <code> b </code> is permitted not only if <code> a </code> and <code> b </code> are of the same type, but more generally if <code> a </code> and <code> b </code> are of reference types <code> A </code> and <code> B </code>, based on classes <code> A </code> and <code> B </code> such that <code> B </code> is a descendant of <code> A </code>.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|14 Putting a System Together]]
|
||||
[[Property:link_title|I2E: Putting a System Together]]
|
||||
[[Property:weight|-1]]
|
||||
[[Property:uuid|97460714-8ae1-a7cb-8216-235827045ea6]]
|
||||
We have now studied the constituents of Eiffel software. It remains to see how you can combine these elements into executable '''systems''' (the Eiffel concept closest to the traditional notion of program) and libraries.
|
||||
|
||||
How do you get an executable system? All you need is to <br/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|5 Types]]
|
||||
[[Property:link_title|I2E: Types]]
|
||||
[[Property:weight|-10]]
|
||||
[[Property:uuid|344a9fdc-3346-5e2d-5fdd-77464e92f72f]]
|
||||
Eiffel is strongly typed for readability and reliability. Every entity is declared of a certain type, which may be either a reference type or an expanded type.
|
||||
|
||||
Any type <code> T </code> is based on a class, which defines the operations that will be applicable to instances of <code> T </code>. The difference between the two categories of type affects the semantics of an entity <code> x </code> declared of type <code> T </code>: for a reference type, the most common case, possible values for <code> x </code> are references to objects; for an expanded type, the values are objects. In both cases, the type rules guarantee that the objects will be instances of <code> T </code>.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[[Property:title|1 What Must I Know First?]]
|
||||
[[Property:link_title|I2E: What Must I Know First?]]
|
||||
[[Property:weight|-14]]
|
||||
[[Property:uuid|f40b4a30-87f7-2c27-b6e7-ef2f2a74661b]]
|
||||
This Invitation assumes that you have some experience of software development, but that's all. Previous exposure to object technology is not required. If you've had it, it will help; but if it has all been to notations like UML or programming languages like C++ and Java, you should not let it guide your study of this Invitation. Although Eiffel shares a number of properties with these other approaches, it takes a fresh path to object technology, based on a small number of simple, far-reaching concepts.
|
||||
|
||||
Once you are familiar with the basic ideas you may want to try them with EiffelStudio, which provides a direct implementation of the Eiffel concepts, available in a completely portable way across Windows, Linux, many versions of Unix and OpenVMS.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[[Property:title|Invitation to Eiffel]]
|
||||
[[Property:weight|-15]]
|
||||
[[Property:uuid|7a606387-2653-b122-b4ef-e283a389656e]]
|
||||
The Invitation to Eiffel is a short set of pages that should give you the "essence" of what Eiffel is all about, without taking too much of your time. Enjoy this profoundly different way of thinking about developing software! When you are done, move on to the more detailed Eiffel tutorial.
|
||||
The Invitation to Eiffel is a short set of pages that should provide you with the essence the Eiffel way, without taking too much of your time. Enjoy this profoundly different way of thinking about developing software! When you are done, move on to the more detailed Eiffel tutorial.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user