Best Practices
Best Practices
Follow proven standards to reduce risk
Enforceable guidelines from our catalog
Avoid Complex Inheritance in Public Classes
Complex inheritance in public classes can leak implementation details, inhibit type evolution, and obscure documentation. Prefer using composition or simple inheritance to implement the required functionality.
Avoid Mutable Global Variables
Avoid mutating global variables, instead opting for dependency injection. This applies to function references as well as other kinds of values. Global variables make code difficult to test and reason about, and can lead to subtle bugs.
Prefer Composition Over Complex Inheritance
Complex inheritance hierarchies can leak implementation details and make code difficult to maintain. Prefer composition and clear interfaces over deep inheritance chains.
Sign up for free
and get unlimited access to our guidelines catalog
and get unlimited access to our guidelines catalog