Welcome to 'Eiffel for Everyone at Wikibooks.
First developed by Bertrand Meyer, Eiffel has a clean and very readable syntax. Many of the design principles of the language emphasize the readability and maintainability of the code.
Because of its excellent implementation of language features like multiple inheritance and generics (especially constrained generics) it takes less code to express complex ideas in Eiffel than it does in other programming languages. A strong type system with exhaustive static type checking allows programs to scale easily in size, and to evolve in ways that are difficult to achieve with other languages.
Eiffel has been criticized for being a verbose language, and it's easy to get hung up on the verbosity of some of its constructs (like its loop statement). Yet I've found that other languages that are often hyped for their terseness, especially the C family with Java and C++, can be very verbose in declaration and use of complex types.
Guiding Design PrinciplesEdit
- Everything is an Object
- Design by Contract
- Single Entry, Single Exit
- The Open/Closed Principle
- Command/Query Separation
Eiffel Features -- What's Unique the LanguageEdit
Contracts and contract inheritance Rich set of assertions Multiple Inheritance Constrained Genericity Type-safe agents (also known as closures) Void Safety SCOOP (Simple Concurrent Object Oriented Programming)
Anatomy of a ClassEdit
Parts of a classEdit
Eiffel Names Reserved words Notes or indexing Name Inherit create features more notes the end Features Attributes Functions The Uniform Access Principle Procedures Commands vs Queries
Nuts and BoltsEdit
Implementing Features Local Variables Creating objects Assignment Calling features Operators Expressions Copying Objects Comparing Objects Conditional control The if statement The inspect statement Iteration -- looping Flow of Control Attachment Checking and Locals (e.g. if attached l_foo as al_foo then ... end)
Expanded Types INTEGERs of Various Sizes REALs CHARACTERs BOOLEAN Reference Types ANY STRINGs DATE Containers
What's required What's ensured Invariants: What is always true (about a class) Checks Variants and loop contracts
Why its useful How it works LSP Renaming Redefining Undefining Extending Non-conforming inheritance Implementation inheritance Multiple inheritance Inheritance of Contracts
With Containers With Algorithms Constrained Genericity Example: Hash tables
Uses for tuples Returning multiple values from a function Named tuples
As a way of iterating over containers Using agents Closed and Open Arguments Agent declarations
Covariance and Anchored Types
Really Advanced TopicsEdit
Memory Management Details Garbage Collection Limitations Interfacing to Other Languages .Net Support Low-level Debugging