Chapter 18. Table-Driven Methods

 < Free Open Study > 

cc2e.com/1865

Contents

  • General Considerations in Using Table-Driven Methods page 411

  • Direct Access Tables page 413

  • Indexed Access Tables page 425

  • Stair-Step Access Tables page 426

  • Other Examples of Table Lookups page 429

Related Topics

  • Information hiding: "Hide Secrets (Information Hiding)" in Section 5.3

  • Class design: Chapter 6

  • Using decision tables to replace complicated logic: in Section 19.1

  • Substitute table lookups for complicated expressions: in Section 26.1

A table-driven method is a scheme that allows you to look up information in a table rather than using logic statements (if and case) to figure it out. Virtually anything you can select with logic statements, you can select with tables instead. In simple cases, logic statements are easier and more direct. As the logic chain becomes more complex, tables become increasingly attractive.

If you're already familiar with table-driven methods, this chapter might be just a review. In that case, you might examine "Flexible-Message-Format Example" in Section 18.2 for a good example of how an object-oriented design isn't necessarily better than any other kind of design just because it's object-oriented, and then you might move on to the discussion of general control issues in Chapter 19.

 < Free Open Study > 


Code Complete
Code Complete: A Practical Handbook of Software Construction, Second Edition
ISBN: 0735619670
EAN: 2147483647
Year: 2003
Pages: 334

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net