Interfaces

Public and Private interfaces

Sandi Metz in “Practical Object-Oriented Design in Ruby” has a great bullet list on what our methods communicate in our code.

Public interfaces

  • expected to be invoked by others
  • are safe for others to depend on
  • have tests
  • reveal primary responsibility

Private interfaces

  • handle implementation details
  • can change for some reason
  • aren’t safe for others to depend on
  • aren’t expected to be send by other objects