CS1 in Ada
An Introduction to Problem Solving and Ada Programming
An Ada Textbook for the CS1 Course
by
Leon E. Winslow
e-mail
to author
The goal of this book is to introduce the student to problem solving,
algorithms and programming using the Ada language. Topics covered include
algorithm development, elementary programming, program structures, debugging,
data representation. Ada features covered include data types, assignments,
loops, procedures, functions, arrays, records, and objects.
The best description is probably by a former student who stated that
the book contains everything that a young computer scientist needs to know
in an easy to understand form.
-
Major Features
-
Problem solving skills emphasized
in the Denning report with the
-
Language skills emphasized in
the Koffmann CS 1 report and the
-
Software engineering skills necessary
for the modern programmer.
-
Excellent pedagogy to insure that
the students actually master the material.
-
Sections on the social history of computing, computer limitations, and
computer ethics. The latest curriculum recommendation suggests some introduction
to these areas for all students.
-
Outlines
-
Users , both students and faculty,
found the book to be an excellent book for the beginner.
-
Availability
Free Copy. The complete book can be downloaded in both PostScript
and PDF forms. One copy to a customer for free. The book cannot be
reproduced or copied in any other form without prior written permission
from the author. To download click on:
a. PostScript Version
(A PostScript reader and printer is available from GhostReader.)
or
b. PDF Version
(A PDF reader and printer is available from Adobe.)
This version is courtesy of Allen Starr who generously converted the postscript
version to PDF.
Problem Solving
The Denning report singled out the inability to solve problems as the
greatest weakness of computer science majors. The whole book is built around
a series of problem solving paradigms with detailed examples including
many exercises for each paradigm. It covers the standard CS1 material while
emphasizing:
-
a disciplined approach to problem solving methods.
-
emphasis on objects and algorithms as valuable tools for problem understanding
and solution.
-
an introduction to program and data abstraction.
-
a foundation for further studies in computer science.
-
problem solving techniques: a problem solution consists of combining
objects and well structured algorithms so that the result is easily translated
into well structured Ada programs.
-
learning by doing: Many completely worked out examples and programs
illustrate the techniques used. Over 500 carefully graded exercises are
included, with each exercise keyed to the pertinent section of the book.
Language
Yet, students must also learn a language. Ada is a particularly good
language for teaching beginners, so the Ada language is integrated into
the book. In addition to the Ada features that are roughly equivalent to
standard Pascal, the book also covers such new, software engineering oriented
concepts as packages and exceptions.
-
data types, objects, assignment, ifs, loops, input and output, arrays,
records, packages, exceptions, etc.
-
early use of subprograms: Subprograms simplify problem solution and
emphasize software engineering principles of modularization and top-down
design.
-
circular presentation.
Software Engineering
Good software engineering habits must be established before
the
students have a chance to develop bad ones. To this end, the book is designed
to emphasize:
-
Top-Down design using
-
Algorithms
-
Objects
-
Structured programming
-
Modularity
-
Localization
-
Efficiency
-
Understandability:
-
Coding style
-
Isolate data structures (objects) and algorithms
-
Uniformity of notation and approach
Pedagogy
-
It presents one new topic at a time.
-
A circular presentation is used for every basic concept and technique.
-
Every new feature and technique is motivated and justified by practical
problems. Each new topic starts with a problem expressed in English, then
presents a technique (and the corresponding Ada syntax) for solving the
problem, and then presents a detailed solution to the problem using the
new concept.
-
Each section ends with a set of exercises designed to illustrate the
technique developed in this section and to give the student practice in
using the technique.
User Satisfaction
The book is classroom tested by several instructors over the past several
years. The students love the approach and by the end of the semester they
have no trouble solving problems and developing programs that run to several
hundred lines of code with several layers of subprograms.
The faculty who have used the book have concluded:
-
Ada is easier to teach than Pascal. The students learn the concepts
faster and easier in Ada. The result is that is that more material is covered
with better understanding.
-
The students do learn software engineering principles. Their programs
are well designed and well structured.
-
The book is almost self teaching. It is the first text book that our
students actually read rather than use as a reference.
-
The book is written in a clear, easy style that appeals to students.
Each presentation and example has been thoroughly classroom tested for
comprehension and retention.
Chapters
1. Algorithms and Programs
2. Algorithms and Elementary Ada
3. Control Structures
4. Tables and Problem Solving
5. Procedures
6. Loops
7. Vectors
8. Functions
9. Applications and Good Programs
10. Composite Data Types
11. Structure Charts
12. Data Types and Object Oriented Programming
13. Computing and Society
Brief Table of Contents
1. Algorithms and Programs
-
1.1. Computers
-
1.2. Languages
-
1.3. Problem Solution
2. Algorithms and Elementary Ada
-
2.1. The Input, Calculate, Output Pattern
-
2.2. Some Simple Ada Programs
-
2.3 Tools for Developing a Computer Solution to a Word Problem
-
2.4. Running a Program
-
2.5. Notes on Programming Style
-
2.6. Debugging
3. Control Structures
-
3.1. Selection
-
3.2. Repetition
-
3.3. Debugging
4. Tables and Problem Solving
-
4.1. Tables
-
4.2. The Float Data Type
-
4.3. Output Graphs
-
4.4. Row Operations on Tables The book features include:
-
4.5. The Simple While Loop
-
4.6. Column Operations on Tables
5. Procedures
-
5.1. Procedures
-
5.2. Tables, Tables, Tables
6. Loops
-
6.1. General While
-
6.2. Choosing the Correct Kind of Loop
-
6.3. Loops and the Float Data Type
-
6.4. Trailer Loops
-
6.5. Multiple Loops
7. Vectors
-
7.1. Simple Vector Programs
-
7.2. Vector Procedures
8. Functions
-
8.1. Simple Functions
-
8.2. Vector Functions
-
8.3. Recursive Functions
9. Applications and Good Programs
-
9.1. Some uses of Vectors
-
9.2 Fast, Faster, Fastest
-
9.3 Robust Algorithms and Programs
-
9.4 Libraries and Efficiency and Robustness
10. Composite Data Types
-
10.1 Subtypes
-
10.2 Data Type Packages
-
10.3 Arrays
-
10.4 Records
-
10.5 Tables via Arrays of Records
11. Structure Charts
-
11.1 Sequential Structures
-
11.2 Groups within Files
-
11.3 Structures with Choice
-
11.4 The Ada If...Elsif Statement
-
11.5 Another Way to Group Records
12. Data Types and Object Oriented Programming
-
12.1 Do-it Yourself Data Types
-
12.2 Another Kind of Object
13. Computing and Society
-
13.1. A Brief Social History of Computing
-
13.2 Computer Limitations
-
13.3 Computers and Ethics
Detailed Table of Contents
1. Algorithms and Programs
1.1. Computers
1.2. Languages
1.3. Problem Solution
2. Algorithms and Elementary Ada
2.1. The Input, Calculate, Output Pattern
2.2. Some Simple Ada Programs
-
2.2.1. A First Program--Simple Output
-
2.2.2. Integer Input and Output
-
2.2.3. Running a Program Interactively
-
2.2.4. Integer Arithmetic
2.3 Tools for Developing a Computer Solution to a Word Problem
-
2.3.1. Object Specification
-
2.3.2. Object Specification Table
-
2.3.3. Data Input
-
2.3.4. Integer Calculations
-
2.3.5. Literals
-
2.3.6. Output
-
2.3.7 Finally, a Program
2.4. Running a Program
2.5. Notes on Programming Style
-
2.5.1. Program Format
-
2.5.2. Comments
2.6. Debugging
3. Control Structures
3.1. Selection
-
3.1.1. Algorithms---IC(S)O
-
3.1.2. The If Statement in Ada
-
3.1.3. Algorithms---ICO(S)
-
3.1.4. The Single Branched Selection
-
3.1.5. Compound Conditions
3.2. Repetition
-
3.2.1. Algorithms---Repeat
-
3.2.2. The For Statement in the Ada Language
-
3.2.3. An Example
-
3.2.4. The Initialize, Repeat Pattern
-
3.2.5. Data Input with Repeat Construct
3.3. Debugging
4. Tables and Problem Solving
4.1. Tables
-
4.1.1. The Table Pattern
-
4.1.2. Tables as a Simplifying Technique
4.2. The Float Data Type
-
4.2.1. Comparison of Integer and Float Data Type
-
4.2.2. Float and Integer Division
-
4.2.3. Float Operations
-
4.2.4. Mixed Type Arithmetic
-
4.2.5. Changing between Integer and Float
4.3. Output
-
4.3.1. Formats
-
4.3.2. Graphs
4.4. Row Operations on Tables The book features include:
-
4.4.1. Tables Using Selected Rows
-
4.4.2. Dependent Rows
4.5. The Simple While Loop
4.6. Column Operations on Tables
-
4.6.1. Column Sums and Averages
-
4.6.2. Minimums and Maximums of Columns
5. Procedures
5.1. Procedures
-
5.1.1. Subprograms
-
5.1.2. Procedures with Parameters
-
5.1.3. Reusing Subprograms
5.2. Tables, Tables, Tables
-
5.2.1. Similar Tables
-
5.2.2. Ada and Multiple Procedures
-
5.2.3. Sequential Tables
6. Loops
6.1. General While
-
6.1.1. The Initialize, Repeat(while), Terminate Pattern
-
6.1.2. Correct use of the Repeat(while)
-
6.1.3. The Ada While Loop
6.2. Choosing the Correct Kind of Loop
6.3. Loops and the Float Data Type
6.4. Trailer Loops
6.5. Multiple Loops
-
6.5.1. Sequential Loops
-
6.5.2. Nested Loops
7. Vectors
7.1. Simple Vector Programs
-
7.1.1. Vectors and Vector Algorithms
-
7.1.2. Ada Programs using Vectors
-
7.1.3. Codes and Vectors
-
7.1.4. Subscripts
-
7.1.5. Vector Loops
7.2. Vector Procedures
-
7.2.1. Writing Vector Procedures in Ada
-
7.2.2. In and Out Parameters
-
7.2.3. Programs using Vector Procedures
8. Functions
8.1. Simple Functions
-
8.1.1. Using Functions
-
8.1.2. Do-it Yourself Functions
8.2. Vector Functions
-
8.2.1. Writing Ada Vector Functions
-
8.2.2. Using Ada Vector Functions
8.3. Recursive Functions
-
8.3.1. Recursive Definitions
-
8.3.2. Recursive Functions
9. Applications and Good Programs
9.1. Some uses of Vectors
-
9.1.1. Lists
-
9.1.2. The Boolean Data Type
-
9.1.3. Tables as Parallel Vectors
-
9.1.4. Sorting
9.2 Fast, Faster, Fastest
-
9.2.1. Speeding up Programs
-
9.2.2. Sequential Search
-
9.2.3. Binary Search
-
9.2.4. Insertion Sort
9.3 Robust Algorithms and Programs
9.4 Libraries and Efficiency and Robustness
10. Composite Data Types
10.1 Subtypes
10.2 Data Type Packages
10.3 Arrays
-
10.3.1 Vectors
-
10.3.2 Matrices
10.4 Records
10.5 Tables via Arrays of Records
11. Structure Charts
11.1 Sequential Structures
-
11.1.1 Single Record Type
-
11.1.2 Multiple Record Type
11.2 Groups within Files
-
11.2.1 Algorithms
-
11.2.2 Ada Programs Using End Of Page
11.3 Structures with Choice
11.4 The Ada If...Elsif Statement
11.5 Another Way to Group Records
12. Data Types and Object Oriented Programming
12.1 Do-it Yourself Data Types
-
12.1.1 Objects and Object Packages
-
12.1.2 Using Data Type Packages
-
12.1.3 Extending a Data Type Package
12.2 Another Kind of Object
-
12.2.1 Vector Data Types
-
12.2.2 List Data Types
13. Computing and Society
13.1. A Brief Social History of Computing
-
13.1.1. Early Days (1940-1955)
-
13.1.2. Commercial Success (1955-1965)
-
13.1.3. Consolidation (1965-1975)
-
13.1.4. Start of a New Era (1975-1985)
-
13.1.5. Another Consolidation (1985-Present)
13.2 Computer Limitations
13.3 Computers and Ethics
-
13.3.1. Individuals
-
13.3.2. Organizations/Society Issues
New visits