Skip to Content

Interface

tags
Book: A Philosophy Of Software Design
  • A shared contract that modules use to interact with each other

  • Interfaces encoding order of execution are a code smell

  • If the interface for commonly used operations forces users to understand rarely used features, that’s a code smell

  • General purpose interfaces are better than specific interfaces

  • Tips to create general purpose interfaces:

    • Can the surface be reduced without affecting functionality?
    • How many situations can the methods of this interface be used?
    • Is it easy to use for common cases?
  • Special-purpose interfaces leak information between modules

  • Simple interfaces should be prioritized over simple implementations

backlinks
Module, Interface, Code Smell,