Summary
This third part is the core of the book and is largely about abstraction. As mentioned in Chapter 1, the evolution of programming languages is essentially about understanding various aspects of abstraction and here we look in depth at the facilities for data abstraction, object oriented programming and programming by contract.
Chapter 12 shows how packages and private types are the keystone of Ada and can be used to control visibility by giving a client and server different views of an object. This chapter also introduces the simplest ideas of type derivation and inheritance and the very important notion of a limited type which is a type (strictly a view of a type) for which copying is not permitted. Limited types are important for modelling those real-world objects for which copying is inappropriate. Chapter 13 then discusses the hierarchical library structure and the facilities for separate compilation. As mentioned earlier, these enable a program to be compiled in distinct units without any loss of strong typing between units.
A third complete program follows Chapters 12 and 13 and illustrates the use of the hierarchical library in the construction of an abstract data type and associated operations.
The basic facilities for object oriented programming are then introduced in Chapter 14. This covers type extension and inheritance, dynamic polymorphism, dispatching, class wide types, abstract types and interfaces. This chapter concentrates very much on the basic nuts and bolts, and a further discussion of OOP is deferred until Chapter 21 when other aspects of the language have been introduced.
Chapter 15 then covers exceptions and is followed by Chapter 16 which discusses the very important topic of contracts which are perhaps the most important new feature introduced in Ada 2012.
Chapter 17 is a detailed discussion of numeric types including modular types and the rather specialized fixed point types which were not discussed in Chapter 6.
Chapters 18 and 19 return to the theme of abstraction by considering two forms of parameterization. Chapter 18 discusses the parameterization of types by discriminants. Chapter 19 discusses genericity which enables both subprograms and packages to be parameterized in many different ways. Genericity provides static polymorphism checked at compile time in contrast to the dynamic polymorphism of type extension.
- Type
- Chapter
- Information
- Programming in Ada 2012 , pp. 227 - 228Publisher: Cambridge University PressPrint publication year: 2014