06. Encapsulation

6.1 Prefer Interfaces to Classes

  • Use interfaces instead of classes where reasonable. This helps reduce implementation dependencies and allows users to provide implementations that can be used by the framework.

6.2 Prefer Private Access and Restrict Scope

  • Class members should be 'private' in most cases.

  • Class and module methods should be scoped as restrictively as possible - <internal> or <private> where appropriate.

Was this helpful?