Good Programs

There are a number of facets to good programs: they must
  1. run correctly
  2. run efficiently
  3. be easy to read and understand
  4. be easy to debug and
  5. be easy to modify.
What does correct mean?

We need to have some formal notion of the meaning of correct: thus we define it to mean

"run in accordance with the specifications".
 

The first of these is obvious - programs which don't run correctly are clearly of little use. "Efficiently" is usually understood to mean in the minimum time - but occasionally there will be other constraints, such as memory use, which will be paramount. As will be demonstrated later, better running times will generally be obtained from use of the most appropriate data structures and algorithms, rather than through "hacking", i.e. removing a few statements by some clever coding - or even worse, programming in assembler!

This course will focus on fundamental issues in programming and one of them is solving problems efficiently: you will be introduced to a number of fundamental data structures and algorithms for manipulating them.

The importance of the other points is less obvious. The early history of many computer installations is, however, testimony to their importance. Many studies have quantified the enormous costs of failing to build software systems that had all the characteristics listed. (A classic reference is Boehm's text, B.J. Boehm, "Software Engineering Economics", Prentice-Hall, 1981 ) Unfortunately, much recent evidence suggests that these principles are still not well understood! The discipline of software engineering is concerned with building large software systems which perform as their users expected, are reliable and easy to maintain. This course will introduce some basic software engineering principles but we will concentrate on the creation of small programs only. By using well-known, efficient techniques for solving problems, not only do you produce correct and fast programs in the minimum time, but you make your programs easier to modify. Another software engineer will find it much simpler to work with a well-known solution than something that has been hacked together and "looks a bit like" some textbook algorithm.

The discipline of Software Engineering was founded when it was discovered that large numbers of software projects
  • exceeded their budgets
  • were late
  • were riddled with errors and
  • did not satisfy their users' needs.