Why learn functional programming?

As a vehicle for learning programming principles a functional language like Miranda has many advantages. As we saw, it is based on a simple model which allows us both to perform evaluation by hand, animating our understanding, and to reason about how the programs behave. In this text, both calculation and reasoning have a central part.

The language is higher-level than most. For example, lists in Miranda are defined directly as a recursive type, and so there is no need to examine their implementation by pointers; indeed the functional language can be used as a design language for the imperative implementation. A second instance is provided by polymorphism; generic definitions are introduced with almost no overhead, in contrast to object-oriented languages such as Modula-3 and C++.

Moreover, the language supports larger-scale programming by means of its abstype and module mechanisms. Again, these have advantages over traditional languages: module versions are kept consistent automatically, for example.

For these reasons we see Miranda as providing a sound introduction to programming principles, which can be complemented later by learning an imperative language. Equally valuable is to learn Miranda after using a more traditional language, since it can broaden our view of the programming process as well as illustrating many software engineering techniques of general worth.

Next Up