Close Window

Show Source |    | About   «  17.18. Program Management   ::   Contents   ::   17.20. Quick Hashing  »

17.19. Project 1 Design

17.19.1. Generalizing Container Classes

Normally for container classes we would want to detach the implementation from the data type. But since the hash function is tied to the key type, we will hard-code the hash tables to the extent that the key type is a String. (But the data type should still be flexible.)
The Memory Manager has a byte array (it doesn’t know strings)

17.19.2. Breaking Down the Project (1)

A bad design: Main file ( initializes program and implements the command processor. Calls hash table to do main operations (which calls memory manager as necessary).

17.19.3. Breaking Down the Project (2)

A better design:
Separate logical activities into separate classes (even if a couple of them end up small this time).
Main class only initializes the program
Command syntax is done in separate command processor class
Command semantics are handled in a separate “world” or “database” class. For P1, this has hash table and memory manager objects.

   «  17.18. Program Management   ::   Contents   ::   17.20. Quick Hashing  »

Close Window