Ada for Software Engineers

Peter Kitson

ISBN : 0471979120

Order a printed copy of this book from Amazon.


Cover Design - Ada for Software Engineers
 

For your free electronic copy of this book please verify the numbers below. 

(We need to do this to make sure you're a person and not a malicious script)

Numbers

 




Sample Chapter From Ada for Software Engineers
     Copyright © M. Ben-Ari



Preface

Albert Einstein once said that ‘things should be as simple as possible, but not simpler’. Einstein could have been talking about programming languages, as the landscape is strewn with ‘simple’ languages that, several versions later, have 500-page reference manuals!

The truth is that we expect a lot of our programming languages. Turing machines just aren’t sophisticated enough for modern software development; we demand support for encapsulation and abstraction, type checking and exception handling, polymorphism and more. Ada, unlike other languages which grew by gradual addition of features, was designed as a coherent programming language for complex software systems. As if to justify Einstein’s saying, Ada is no more complex than the final versions of ‘simpler’ languages.

However, the complexity of modern programming languages leaves textbook writers with a painful dilemma: either gloss over the gory details, or write books that are heavy enough to be classified as lethal weapons. Is there another way?

Strange as it may seem, you can get an excellent concise description of Ada 95 for free: the Ada Reference Manual (ARM) (Taft & Duö 1997), which is the document defining the language standard. The ARM has a reputation for being ponderous reading meant for ‘language lawyers’. Nevertheless, I believe that, with a bit of guidance, software engineers can learn to read most of the ARM. Ada for Software Engineers is written to equip you with the knowledge necessary to use the Ada 95 programming language to develop software systems. I will try to teach you how the individual language constructs are used in actual programs, and I will try to explain the terminology and concepts used in the language standard.

The book is intended for software engineers making the transition to Ada, and for upper-level undergraduate and graduate students (including those who have had the good fortune to study Ada as their first programming language!). No specific Ada knowledge is assumed; the prerequisites are a basic knowledge of computer science and computer systems, and significant programming experience (not necessarily in Ada). As the title implies, this book is for you if you are a software engineer or training to become one.

The Ada language will be taught using a few—relatively large—case studies, rather than a large number of small examples each crafted to demonstrate a particular construct or rule. Experienced programmers know that the key to mastering a programming language is not to memorize the syntax and semantics of individual constructs, but to learn how to integrate the constructs into language-specific paradigms. We will need to gloss over details when explaining a case study; rest assured that everything will eventually be explained, or you will find a pointer to the explanation in the ARM. Certain sections marked with one or two asterisks should be omitted during your initial study of Ada. This material is not necessarily more di÷cult, but you can’t learn everything at once, and these are topics that can be left for your second and third reading of the book.

After an introductory chapter, Chapters 2–4 quickly cover elementary language constructs such as statements, subprograms, arrays, records and pointers that should be familiar from your previous programming experience. The core of the book is the progressive development a of case study demonstrating the Ada constructs for object-oriented programming: packages and private types (Chapter 5), type extension, inheritance, class-wide types and dynamic polymorphism (Chapter 6) and generics (Chapter 7). Chapters 8–12 cover specialized topics: the type system in depth, input–output and program structure.

Chapters 13–16 form a second core of the book, discussing topics broadly covered by the term systems programming: multitasking, hardware interfaces, systems programming, and real-time and distributed systems. Most of these chapters are relatively independent of the material following Chapter 5 on packages.

Appendix A Tips for Transition will help Pascal, C, C++ and Java programmers relate constructs in those languages to the constructs of Ada. A special feature of the book is the Glossary (Appendix B), which explains the ARM terminology with examples. In addition, discussions in the text are cross-referenced to the relevant paragraphs in the ARM.

Appendix D contains a set of quizzes: these are programs designed to demonstrate lesser-known rules of the language. The best way to approach them is to use the hints in Appendix E, which are references to the relevant ARM paragraph, and to look up the answers in Appendix F only after you believe that you have solved a quiz. I have not included programming exercises; my suggestion is that you modify, extend and improve the case studies.

All the case studies, quizzes and programs in the book were compiled and executed. LATEX formatted text was automatically produced from the source code with a small amount of additional manual formatting. The program that transforms Ada source code to LATEX is itself the subject of one of the case studies! Source code that is unchanged from one case study to another is usually omitted; the full source code of each executable program is available on the companion CD-ROM. Files names are given in the margin at the beginning of each program. The CD-ROM also contains Ada 95 compilers, plaintext and hypertext versions of the ARM and other material as specified in Appendix C. Appendix G is a guide to sources of information on Ada, both printed and electronic. The painting on the cover is The Railway Bridge, Argentueil by Claude Monet. Ada has been extensively used in the construction of software for rail systems which are known for their high level of safety and reliability.