Key Points

  • Tables provide an alternative to complicated logic and inheritance structures. If you find that you're confused by a program's logic or inheritance tree, ask yourself whether you could simplify by using a lookup table.

  • One key consideration in using a table is deciding how to access the table. You can access tables by using direct access, indexed access, or stair-step access.

  • Another key consideration in using a table is deciding what exactly to put into the table.

Get Code Complete, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.