CSci 450-01: Organization of Programming Languages
CSci 503-01: Fundamental Concepts in Languages
Fall 2014


Lua Module Design Principles

The List module design reflects the following principles, motivated by good software design practices and the module implementation recommendations given in Chapter 15 of the textbook "Programming in Lua" (PiL).

  1. All variables and function names should be local to the module. That is, they are Lua local variables.
  2. The module should only export those names that need to be exposed to users of the module. These names form the interface to the module. Following the recommendations in PiL, this module uses an explicit return statement that returns a table of references to the functions in the public interface.
  3. The design of the module should follow the information hiding principle.

    The goal of information hiding is to enable an aspect of the overall software system design that might change among versions to be changed without affecting many modules. That is, a likely change should be isolated in one module so that changes to that module's code should not break code in other modules. The approach requires us to identify the key design decision (e.g., the choice of a concrete data representation or algorithm) and keep that decision secret` to that module.

    The module should:

  4. The designer should identify the preconditions and postconditions of each function and, where feasible, check the precondition of any function in the public interface.


Copyright © 2014, H. Conrad Cunningham
Last modified: Sun Nov 30 22:33:29 CST 2014