Chapter 10
Case study: Huffman codes
Aims
-
To present the basics of the Miranda module system: %include and
%export.
-
To introduce the basic rules of modular design, and to illustrate their use in
a substantial case study.
-
To introduce the Huffman
coding and decoding mechanisms, as examples of interesting non-trivial
algorithms.
Issues
Other case studies
Of necessity any reasonable examples of sets of modules will be sizable.
-
The simulation, interaction and calculator examples from this text can be
found in the directories Simulation, Interactions and
Calculator found in the code distribution. For details of how to
obtain the code click
here.
-
The examples of regular expressions and program semantics given on the further
work page also contain systems of modules. For more details click
here.
It would be a useful exercise to give a graphical representation of these sets
of modules, and also to explore ways in which the systems might be structured
differently.
Other systems
It would also be a useful exercise to examine earlier projects, such as the
supermarket billing exercises, to see how they might be modularised.
Next
Up
Written 18 May 1995.