0% developed

Eiffel Programming

From Wikibooks, open books for an open world
(Redirected from Eiffel programming)
Jump to navigation Jump to search

Welcome to 'Eiffel for Everyone at Wikibooks.

About Eiffel[edit | edit source]

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 Principles[edit | edit source]

  • Everything is an Object
  • Design by Contract
  • Single Entry, Single Exit
  • The Open/Closed Principle
  • Command/Query Separation

Past, Present and Future Versions[edit | edit source]

Eiffel Un-features -- What You Won't See In Eiffel[edit | edit source]

Eiffel Features -- What's Unique About the Language[edit | edit source]

  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 Class[edit | edit source]

Parts of a class[edit | edit source]

   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 Bolts[edit | edit source]

  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)

Base Types[edit | edit source]

  Expanded Types
    INTEGERs of Various Sizes
    REALs
    CHARACTERs
    BOOLEAN
  Reference Types
    ANY
    STRINGs
    DATE
  Containers

Contracts[edit | edit source]

  What's required
  What's ensured
  Invariants: What is always true (about a class)
  Checks
  Variants and loop contracts

Inheritance[edit | edit source]

  Why its useful
  How it works
    LSP
  Renaming
  Redefining
  Undefining
  Extending
  Non-conforming inheritance
  Implementation inheritance
  Multiple inheritance
  Inheritance of Contracts

Generics[edit | edit source]

  With Containers
  With Algorithms
  Constrained Genericity
  Example: Hash tables
  

Tuples[edit | edit source]

 Uses for tuples
 Returning multiple values from a function
 Named tuples

Agents[edit | edit source]

 As a way of iterating over containers
 Using agents
 Closed and Open Arguments
 Agent declarations

Libraries[edit | edit source]

Advanced Topics[edit | edit source]

 Covariance and Anchored Types
 

Really Advanced Topics[edit | edit source]

  Memory Management Details
     Garbage Collection Limitations
  Interfacing to Other Languages
  .Net Support
  Low-level Debugging
  

Additional Reading[edit | edit source]