跳轉至內容

Eiffel 程式設計

0% developed
來自華夏公益教科書,開放的世界,開放的書籍

歡迎來到華夏公益教科書上的Eiffel for Everyone

關於 Eiffel

[編輯 | 編輯原始碼]

Eiffel 最初由Bertrand Meyer 開發,它擁有簡潔且非常易讀的語法。語言的許多設計原則都強調程式碼的可讀性和可維護性。

由於出色地實現了語言特性,如多重繼承泛型(尤其是受限泛型),在 Eiffel 中用更少的程式碼表達複雜的想法比其他程式語言更容易。強大的型別系統以及詳盡的靜態型別檢查允許程式輕鬆擴充套件規模,並以其他語言難以實現的方式演進。

Eiffel 因為過於冗長而受到批評,並且很容易被某些結構的冗長所困擾(比如它的迴圈語句)。然而,我發現其他經常被吹捧為簡潔的語言,尤其是 C 家族中的 Java 和 C++,在複雜型別的宣告和使用中可能會非常冗長。

指導設計原則

[編輯 | 編輯原始碼]
  • 一切皆物件
  • 契約式設計
  • 單入口,單出口
  • 開閉原則
  • 命令/查詢分離

Eiffel 特性 - 語言的獨特之處

[編輯 | 編輯原始碼]
  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)

類的解剖

[編輯 | 編輯原始碼]

類的一部分

[編輯 | 編輯原始碼]
   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

基礎知識

[編輯 | 編輯原始碼]
  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
 

非常高階的主題

[編輯 | 編輯原始碼]
  Memory Management Details
     Garbage Collection Limitations
  Interfacing to Other Languages
  .Net Support
  Low-level Debugging
  

擴充套件閱讀

[編輯 | 編輯原始碼]
華夏公益教科書