from eiffel and design by contract to trusted components
play

From Eiffel and Design by Contract to Trusted Components Bertrand - PowerPoint PPT Presentation

From Eiffel and Design by Contract to Trusted Components Bertrand Meyer ETH Zrich / Eiffel Software Budapest, December 2003 1 My background Since 1985: Founder (now Chief Architect) of Eiffel Software, in Santa Barbara. Produces


  1. From Eiffel and Design by Contract to Trusted Components Bertrand Meyer ETH Zürich / Eiffel Software Budapest, December 2003 1

  2. My background � Since 1985: Founder (now Chief Architect) of Eiffel Software, in Santa Barbara. Produces advanced tools and services to improve software quality, based on Eiffel ideas � Since 2001: Professor of Software Engineering at ETH Zürich � Also adjunct professor at Monash University in Australia (since 1998) 2

  3. Software engineering The collection of processes, methods, techniques, tools and languages for developing quality operational software. 3

  4. The challenge � What does it take to bring software engineering to the next level? 4

  5. Today’s software is often good enough Overall: � Works most of the time � Doesn’t kill too many people � Negative effects, esp. financial, are diffuse Significant improvements since early years: � Better languages � Better tools � Better practices (configuration management) 5

  6. Eiffel � Method, language and environment � Fully object-oriented; not a hybrid with other approaches � Focuses on quality, especially reliability, extendibility and reusability � Emphasizes simplicity � Used for many mission-critical projects in industry � International standard in progress through ECMA 6

  7. Large Eiffel projects in industry AXA Rosenberg Chicago Board of Trade Boeing AMP Investments Lockheed Martin EMC Cap Gemini Ernst & Young Environmental Protection Agency Hewlett Packard Northrop Grumman Swedish National Health Board ENEA 7

  8. Environment: the two offerings from Eiffel Software � EiffelStudio (“Classic Eiffel”) Windows, Unix, Linux, VMS, .NET ... � ENViSioN! for Visual Studio .NET Projects are compatible 8

  9. EiffelStudio EiffelBuild User EiffelBase GUI builder classes Persistent General library Browsing, fast compiling objects (Melting Ice™), debugging, EiffelVision diagrams, metrics... Multiplatform GUI library Serialization WEL Ansi C C compilation Win32 GUI Executable EiffelWeb EiffelStudio Eiffel compilation system Jitter Web scripting IL EiffelMath EiffelStore Advanced numerics Eiffel Runtime EiffelNet Databases Networking (Rel, OO) External .NET EiffelCOM C/C++/Java Assemblies 9

  10. EiffelStudio: Melting Ice™ Technology � Fast recompilation: time depends on size of change, not size of program � “Freeze” once in a while � Optimized compilation: finalize. 10

  11. Melting Ice Technology YOUR SYSTEM FREEZING FROZEN Machine code EIFFELSTUDIO Execution, (from C code) browsing , debugging, documentation ... MELTING MELTED 11

  12. Portability Full source-code portability across: � Windows NT, 2000, XP � Windows 98, Me � Solaris, other commercial Unix variants � Linux � BSD (Berkeley System Distribution) � VMS 12

  13. Portable graphics EiffelVision 2 library: � Simple programming model � Produce impressive GUI simply and quickly � Easy to learn � Completely portable across supported platforms � Rich set of controls, matches users’ most demanding needs � Adapts automatically to native look & feel 13

  14. EiffelVision layers EiffelVision EiffelVision WEL GEL etc . 14

  15. Openness to other approaches � Extensive mechanisms to support C and C++ constructs � Java interface � On .NET, seamless integration with C#, Visual Basic etc. 15

  16. Special syntax for C/C++ support class class RECT_STRUCT RECT_STRUCT feature -- -- Access Access feature x (a_struct x ( a_struct: POINTER): INTEGER : POINTER): INTEGER is is external external "C struct struct RECT access x use < RECT access x use <windows.h windows.h>" >" "C end end feature -- -- Settings Settings feature set_x ( (a_struct a_struct: POINTER; : POINTER; a_x a_x: INTEGER) : INTEGER) is is set_x external external "C struct struct RECT access x type RECT access x type int int use < use <windows.h windows.h>" >" "C end end end end 16

  17. Performance � Optimizations are automatic: Inlining, dead code removal… � Garbage collection takes care of memory issues � Performance matches the demand of the most critical industry applications 17

  18. Eiffel mechanisms � Classes, objects, ... � Single and multiple inheritance � Inheritance facilities: redefinition, undefinition, renaming � Genericity, constrained and unconstrained � Safe covariance � Disciplined exception handling, based on principles of Design by Contract � Full GC � Agents (power of functional programming in O-O!) � Unrestricted streaming: files, databases, networks... 18

  19. Genericity Since 1986 (First time genericity & inheritance combined) Unconstrained LIST [G] e.g. LIST [INTEGER], LIST [PROFESSOR] Constrained HASH_TABLE [G ―> HASHABLE] VECTOR [G ―> NUMERIC] 19

  20. Multiple inheritance TRAIN_CAR RESTAURANT RESTAURANT_ CAR 20

  21. Development: the traditional model Separate tools: � Programming environment � Analysis & design tools, e.g. UML Consequences: � Hard to keep model, implementation, documentation consistent � Constantly reconciling views � Inflexible, hard to maintain systems � Hard to accommodate bouts of late wisdom � Wastes efforts � Damages quality 21

  22. Development: the Eiffel model Seamless development: � Single set of notation, tools, concepts, principles throughout � Eiffel is as much for analysis & design as for implementation & maintenance � Continuous, incremental development � Keep model, implementation and documentation consistent � Reversibility: can go back and forth � Saves money: invest in single set of tools � Boosts quality 22

  23. Seamless development (1) TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... Example classes 23

  24. Seamless development (2) TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... STATE, USER_COMMAND... Design Example classes 24

  25. Seamless development (3) TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... STATE, USER_COMMAND... Design HASH_TABLE, Implementation LINKED_LIST... Example classes 25

  26. Seamless development (4) TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... STATE, USER_COMMAND... Design HASH_TABLE, Implementation LINKED_LIST... TEST_DRIVER, ... V & V Example classes 26

  27. Seamless development (5) TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... STATE, USER_COMMAND... Design HASH_TABLE, Implementation LINKED_LIST... TEST_DRIVER, ... V & V Genera- AIRCRAFT, ... lization Example classes 27

  28. Eiffel for analysis deferred class VAT inherit TANK feature in_valve , out_valve : VALVE Precondition fill is -- Fill the vat. require in_valve.open -- Specified only. out_valve.closed -- not implemented. deferred ensure in_valve.closed out_valve.closed Postcondition is_full end Class empty , is_full , is_empty , gauge , maximum , ... [Other features] ... invariant invariant is_full = ( gauge >= 0.97 * maximum ) and ( gauge <= 1.03 * maximum ) end 28

  29. Seamless development TRANSACTION, PLANE, Specification CUSTOMER, ENGINE... STATE, USER_COMMAND... Design HASH_TABLE, Implementation LINKED_LIST... TEST_DRIVER, ... V & V Genera- AIRCRAFT, ... lization Example classes 29

  30. Reversibility S S D I V G 30

  31. Inheritance structure (in EiffelStudio) 31

  32. Design by Contract™ � Get things right in the first place � Automatic documentation � Self-debugging, self-testing code � Get inheritance right � Give managers the right control tools 32

  33. Applications of contracts Analysis, design, implementation: � Get the software right from the start Testing, debugging, quality assurance � Management, maintenance/evolution � Inheritance � Documentation � 33

  34. Design by Contract � A discipline of analysis, design, implementation, management 34

  35. A view of software construction � Constructing systems as structured collections of cooperating software elements — suppliers and clients — cooperating on the basis of clear definitions of obligations and benefits. � These definitions are the contracts. 35

  36. Design by Contract (cont’d) Every software element is intended to satisfy a certain goal, for the � benefit of other software elements (and ultimately of human users). This goal is the element’s contract. � The contract of any software element should be � • Explicit. • Part of the software element itself. 36

  37. A human contract OBLIGATIONS BENEFITS deliver (Satisfy precondition:) (From postcondition:) Client Bring package before Get package delivered 4 p.m.; pay fee. by 10 a.m. next day. (Satisfy postcondition:) (From precondition:) Supplier Deliver package by Not required to do 10 a.m. next day. anything if package delivered after 4 p.m., or fee not paid. 37

  38. Properties of contracts A contract: • Binds two parties (or more): supplier, client. • Is explicit (written). • Specifies mutual obligations and benefits. • Usually maps obligation for one of the parties into benefit for the other, and conversely. • Has no hidden clauses: obligations are those specified. • Often relies, implicitly or explicitly, on general rules applicable to all contracts (laws, regulations, standard practices). 38

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend