C Interfaces and Implementations: Techniques for Creating Reusable Software

Book description

Every programmer and software project manager must master the art of creating reusable software modules; they are the building blocks of large, reliable applications. Unlike some modern object-oriented languages, C provides little linguistic support or motivation for creating reusable application programming interfaces (APIs). While most C programmers use APIs and the libraries that implement them in almost every application they write, relatively few programmers create and disseminate new, widely applicable APIs. C Interfaces and Implementations shows how to create reusable APIs using interface-based design, a language-independent methodology that separates interfaces from their implementations. This methodology is explained by example. The author describes in detail 24 interfaces and their implementations, providing the reader with a thorough understanding of this design approach.

Features of C Interfaces and Implementations:

  • Concise interface descriptions that comprise a reference manual for programmers interested in using the interfaces.

  • A guided tour of the code that implements each chapter's interface tp help those modifying or extending an interface or designing related interfaces.

  • In-depth focus on "algorithm engineering:" how to package data structures and related algorithms into reusable modules.

  • Source code for 24 APIs and 8 sample applications is examined, with each presented as a "literate program" in which a thorough explanation is interleaved with the source code.

  • Rarely documented C programming tricks-of-the-trade.

  • Convenient access to all source code in the book via the World Wide Web at http://www.cs.princeton.edu/software/cii/

Table of contents

  1. Copyright
  2. Addison-Wesley Professional Computing Series
  3. Preface
    1. Organization
    2. Instructional Use
    3. How to Get the Software
  4. Acknowledgments
  5. 1. Introduction
    1. 1.1. Literate Programs
    2. 1.2. Programming Style
    3. 1.3. Efficiency
    4. Further Reading
    5. Exercises
  6. 2. Interfaces and Implementations
    1. 2.1. Interfaces
    2. 2.2. Implementations
    3. 2.3. Abstract Data Types
    4. 2.4. Client Responsibilities
    5. 2.5. Efficiency
    6. Further Reading
    7. Exercises
  7. 3. Atoms
    1. 3.1. Interface
    2. 3.2. Implementation
    3. Further Reading
    4. Exercises
  8. 4. Exceptions and Assertions
    1. 4.1. Interface
    2. 4.2. Implementation
    3. 4.3. Assertions
    4. Further Reading
    5. Exercises
  9. 5. Memory Management
    1. 5.1. Interface
    2. 5.2. Production Implementation
    3. 5.3. Checking Implementation
    4. Further Reading
    5. Exercises
  10. 6. More Memory Management
    1. 6.1. Interface
    2. 6.2. Implementation
    3. Further Reading
    4. Exercises
  11. 7. Lists
    1. 7.1. Interface
    2. 7.2. Implementation
    3. Further Reading
    4. Exercises
  12. 8. Tables
    1. 8.1. Interface
    2. 8.2. Example: Word Frequencies
    3. 8.3. Implementation
    4. Further Reading
    5. Exercises
  13. 9. Sets
    1. 9.1. Interface
    2. 9.2. Example: Cross-Reference Listings
    3. 9.3. Implementation
      1. 9.3.1. Member Operations
      2. 9.3.2. Set Operations
    4. Further Reading
    5. Exercises
  14. 10. Dynamic Arrays
    1. 10.1. Interfaces
    2. 10.2. Implementation
    3. Further Reading
    4. Exercises
  15. 11. Sequences
    1. 11.1. Interface
    2. 11.2. Implementation
    3. Further Reading
    4. Exercises
  16. 12. Rings
    1. 12.1. Interface
    2. 12.2. Implementation
    3. Further Reading
    4. Exercises
  17. 13. Bit Vectors
    1. 13.1. Interface
    2. 13.2. Implementation
      1. 13.2.1. Member Operations
      2. 13.2.2. Comparisons
      3. 13.2.3. Set Operations
    3. Further Reading
    4. Exercises
  18. 14. Formatting
    1. 14.1. Interface
      1. 14.1.1. Formatting Functions
      2. 14.1.2. Conversion Functions
    2. 14.2. Implementation
      1. 14.2.1. Formatting Functions
      2. 14.2.2. Conversion Functions
    3. Further Reading
    4. Exercises
  19. 15. Low-Level Strings
    1. 15.1. Interface
    2. 15.2. Example: Printing Identifiers
    3. 15.3. Implementation
      1. 15.3.1. String Operations
      2. 15.3.2. Analyzing Strings
      3. 15.3.3. Conversion Functions
    4. Further Reading
    5. Exercises
  20. 16. High-Level Strings
    1. 16.1. Interface
    2. 16.2. Implementation
      1. 16.2.1. String Operations
      2. 16.2.2. Memory Management
      3. 16.2.3. Analyzing Strings
      4. 16.2.4. Conversion Functions
    3. Further Reading
    4. Exercises
  21. 17. Extended-Precision Arithmetic
    1. 17.1. Interface
    2. 17.2. Implementation
      1. 17.2.1. Addition and Subtraction
      2. 17.2.2. Multiplication
      3. 17.2.3. Division and Comparison
      4. 17.2.4. Shifting
      5. 17.2.5. String Conversions
    3. Further Reading
    4. Exercises
  22. 18. Arbitrary-Precision Arithmetic
    1. 18.1. Interface
    2. 18.2. Example: A Calculator
    3. 18.3. Implementation
      1. 18.3.1. Negation and Multiplication
      2. 18.3.2. Addition and Subtraction
      3. 18.3.3. Division
      4. 18.3.4. Exponentiation
      5. 18.3.5. Comparisons
      6. 18.3.6. Convenience Functions
      7. 18.3.7. Shifting
      8. 18.3.8. String and Integer Conversions
    4. Further Reading
    5. Exercises
  23. 19. Multiple-Precision Arithmetic
    1. 19.1. Interface
    2. 19.2. Example: Another Calculator
    3. 19.3. Implementation
      1. 19.3.1. Conversions
      2. 19.3.2. Unsigned Arithmetic
      3. 19.3.3. Signed Arithmetic
      4. 19.3.4. Convenience Functions
      5. 19.3.5. Comparisons and Logical Operations
      6. 19.3.6. String Conversions
    4. Further Reading
    5. Exercises
  24. 20. Threads
    1. 20.1. Interfaces
      1. 20.1.1. Threads
      2. 20.1.2. General Semaphores
      3. 20.1.3. Synchronous Communication Channels
    2. 20.2. Examples
      1. 20.2.1. Sorting Concurrently
      2. 20.2.2. Critical Regions
      3. 20.2.3. Generating Primes
    3. 20.3. Implementations
      1. 20.3.1. Synchronous Communication Channels
      2. 20.3.2. Threads
      3. 20.3.3. Thread Creation and Context-Switching
      4. 20.3.4. Preemption
      5. 20.3.5. General Semaphores
      6. 20.3.6. Context-Switching on the MIPS and ALPHA
    4. Further Reading
    5. Exercises
  25. Interface Summary
    1. AP
    2. Arena
    3. Arith
    4. Array
    5. ArrayRep
    6. Assert
    7. Atom
    8. Bit
    9. Chan
    10. Except
    11. Fmt
    12. List
    13. Mem
    14. MP
    15. Ring
    16. Sem
    17. Seq
    18. Set
    19. Stack
    20. Str
    21. Table
    22. Text
    23. Thread
    24. XP
  26. Bibliography

Product information

  • Title: C Interfaces and Implementations: Techniques for Creating Reusable Software
  • Author(s):
  • Release date: August 1996
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780321562807