# Program development

Of course, there is more to writing programs than learning a programming language. Although you will find many books on programming languages, you will not find many on computer programming as such. That is because it is very much a craft. Be aware that this book does not, and cannot, train you to become a professional programmer. Only on-the-job training and experience can do that--but after working through this chapter, you will have an idea of some of the activities a professional programmer does.

In the computer industry, there is a widespread attitude that program maintenance helps build good programmers. There are sound reasons for this. One is that reading other people's programs helps you learn how to lay out programs, how to organise the source, how to write structured code and how to solve the sort of problems that a programmer meets daily. Another reason is that program maintenance usually involves either removing errors (usually called bugs) or making small changes to the program to adapt it to changing requirements. You have to learn how a program works before you change it and reading someone else's program means that the philosophy of the program (the approach of the program to solving a problem) is already there--you do not have to create it.

However, there is no substitute for writing your own programs. The first section of this chapter is concerned with how to write your own programs, from problem analysis to documentation. The next topic discusses how to access operating system procedures. This introduces almost all those aspects of Algol 68 which involve direct machine access apart from the mode `BITS` and its associated operators which were covered in chapter 11.

Next, we turn to the first aspect of program maintenance: how to understand a program. A small utility (`lf`) is provided with the Algol68toC compilation system documentation. This section looks at `lf` and analyses its functioning.

Subsections

- Writing programs
  - Top-down analysis
  - Program layout
  - Declarations
  - Procedures
  - Monetary values
  - Optimisation
  - Testing and debugging
  - Compilation errors
  - Arithmetic overflow
  - Documentation
- Non-canonical input
- A simple utility
  - The source code
  - Routines
  - Dry-running example
  - `ALIEN` procedures
    - The procedure `fstat`
    - The procedure `get cwd`
- Summary