Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering Lecture 4 Vladimir Safonov, Professor, head of laboratory St. Petersburg University WWW:

Similar presentations


Presentation on theme: "Software Engineering Lecture 4 Vladimir Safonov, Professor, head of laboratory St. Petersburg University WWW:"— Presentation transcript:

1 Software Engineering Lecture 4 Vladimir Safonov, Professor, head of laboratory St. Petersburg University Email: v_o_safonov@mail.ru WWW: http://user.rol.ru/~vsafonov

2 (C) Vladimir O. Safonov, 20042 The role of the programming paradigms under consideration Structured programming – systematic design and development of (mainly) the control flow parts (statements) Stepwise refinement – convenient top-down technique of rapid application prototyping Modular programming – systematic program decomposition into relatively independent parts (modules) Also of great importance are techniques for design and development of data types and structures

3 (C) Vladimir O. Safonov, 20043 Abstract Data Types (ADT) Founders (1970s): - Sir Tony Hoare: Oxford University, MSR; - Prof. Barbara Liskov: Massachusetts Institute of Technology - Prof. David Parnas (U.S. and Canadian universities) Basic principles - Type = concrete representation + set of abstract operations - Direct access to concrete representation is not allowed - Handling values (or objects) of the type T is possible only via its abstract operations P1, … Pn, so the type T is encapsulated ADT can be regarded as a kind of modularity (name and set of operations – interface; concrete representation and bodies of operations – implementations Before ADT similar approach was applied to predefined (primitive) types: VAR i: INTEGER; BEGIN … i := i+1; … END

4 (C) Vladimir O. Safonov, 20044 ADT specifics “Types are not sets” (F. Morris) Encapsulation Formal specification of ADT semantics necessary R. Floyd’s – C.A.R. Hoare’s method: P { S } Q Denotational semantics of ADT (D. Scott, J. Donahue): program is a transformer of predicates the kind: P(X1, … Xn), where Xi – set of variables Algebraic specification of ADT (the ADJ group, lead – prof. J.A. Goguen, the author of OBJ specification language): type – multi-sorted algebra; S1, … Sk – sorts (carrier); P1, …, Pm – operations (signature); semantics – set of equates of the kind: T1 = T2 where T1 and T2 - terms

5 (C) Vladimir O. Safonov, 20045 ADT advantages Modularity Increasing reliability Formal specification and verification of ADT ADT libraries and reusability

6 (C) Vladimir O. Safonov, 20046 ADT issues and how to solve them “ADT are non-efficient” (each abstract operation is a routine!) -> using macros and inline routines; program optimization (the task of the compiler rather than user) “ADT are too complicated” (it seems simpler to code “from scratch” and to write explicitly something like: P^.X [index]^.Y := something ) -> such “coding technique” leads to buggy and non- readable programs. ADT is a comfortable technique of abstraction from details: SetMyProp(P, something);

7 (C) Vladimir O. Safonov, 20047 ADT languages FORTRAN & PASCAL - predefined types are regarded as ADT with infix: X+Y or functional: SIN(X) style of operations CLU (B. Liskov) – the first ADT language; played outstanding part in all subsequent development of programming languages – M.I.T., 1974 ALPHARD (M. Shaw, Carnegie-Mellon Univ.) – the“competitive project” to CLU; based on similar ideas, but Hoare-style specification and verification added to the language Ada (package, task); Modula-3 (interface); Java, C# … - contain elements of ADT concept

8 (C) Vladimir O. Safonov, 20048 References and home task to lecture 4 Please read the following papers and get acquainted to their approached to ADT: Liskov B, Guttag J. Using abstractions and specifications in program development. – Addison- Wesley, 1986 Hoare, C.A.R. Proof of correctness of data representation (article, 1972)


Download ppt "Software Engineering Lecture 4 Vladimir Safonov, Professor, head of laboratory St. Petersburg University WWW:"

Similar presentations


Ads by Google