Docsity

Understanding OOP in Eiffel: Concepts, Principles, and Development - Prof. Laura Dillon, Study notes of Programming Languages

Partial preview of the text

Download Understanding OOP in Eiffel: Concepts, Principles, and Development - Prof. Laura Dillon and more Study notes Programming Languages in PDF only on Docsity!

  • Primary object-oriented language concepts โˆ’ dynamic lookup โˆ’ encapsulation โˆ’ inheritance โˆ’ subtyping
  • Program organization โˆ’ Organize concepts into objects and relationships between them โˆ’ Build program to be extensible โ—Š Both open and closed
  • Comparison โˆ’ Objects as closures?

Object Oriented Programming

  • An object consists of โˆ’ hidden or private part โ—Š instance variables / data members โ—Š possibly, also some private functions โˆ’ public part โ—Š public operations, or member functions, or methods, or โ€œmessagesโ€ โ—Š possibly, also some public instance variables
  • In Eiffel terminology:

features

Objects

Hidden part

feature... feature...

  • OO program โˆ’ Creates a โ€œ root object โ€ โ—Š which may create other objects โ—Š which, in turn, may create other objects ... โˆ’ Objects โ—Š send messages to / invoke methods on / apply features of other objects

- Completely object-oriented approach from start to finish

  • Design by contract (DBC) method
  • Language mechanisms supporting OO and DBC โˆ’ Classes, objects, assertions, contracts, ... โˆ’ Single & multiple inheritance with โ—Š redefinition โ—Š undefinition โ—Š renaming โˆ’ Genericity: contrained & unconstrained โˆ’ Uniform type system: safe covariance โˆ’ Agents (power of functional programming in OO) โˆ’ โ€œOnceโ€ mechanisms โˆ’ Conversions โˆ’ Unrestricted streaming: files, databases, networks, ... โˆ’ Full garbage collection

Why study Eiffel?

  • Productivity: faster time to market, fewer developers
  • Reliability: fewer bugs
  • Extensibility: be responsive to customer needs
  • Reuse: stand on the shoulder of giants
  • Efficiency: make the best use of hardware resources
  • Maintainability: spend your time on new developments (Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)

Goals for Eiffel

  • Dogmatic where it counts โˆ’ Information hiding, e.g., not allowed: x.a := b โˆ’ Overloading โˆ’ Style rules โˆ’ โ€œOne good way to do anything.โ€
  • Purposely left out โˆ’ Goto โˆ’ Functions as arguments โˆ’ Pointer arithmetic โˆ’ Cryptic symbols, e.g., x++, ++x
  • Flexible when it makes no point to harass programmers โˆ’ Syntax, e.g., optional semicolonโ€™s (Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)

Dogmatism

  • Fundamental data structures and algorithms
  • Portable graphics
  • Internet, Web
  • Lexical analysis, parsing
  • Database interfaces -... (Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)

Libraries

(Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)

Object-Oriented Software Construction

All you need is code

Code is all you need

--The bOOtles

Seamless development

(Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/) Single notation, tools, concepts, principles Continuous, incremental development Model, implementation, documentation are always consistent Reversibility Example classes at each stage: PLANE, ACCOUNT,... STATE, COMMAND,... HASH_TABLE,... TEST_DRIVER,... TABLE,...

Mini-lifecycle tasks

  • Specification
  • Design / Implementation
  • Verification & Validation (V&V)
  • Generalization (Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)

Language basics

Language mechanisms supporting OO and DBC

โˆ’ Classes, objects, assertions, contracts, ... โˆ’ Single & multiple inheritance with โ—Š redefinition โ—Š undefinition โ—Š renaming โˆ’ Genericity: contrained & unconstrained โˆ’ Uniform type system: safe covariance โˆ’ Agents (power of functional programming in OO) โˆ’ โ€œOnceโ€ mechanisms โˆ’ Conversions โˆ’ Unrestricted streaming: files, databases, networks, ... โˆ’ Full garbage collection (Courtesy of http://se.ethz.ch/teaching/2008-H/eiffel-0291/)