DEV Community

Cover image for 100 Tips from The Pragmatic Programmers Book: Part 6/10
Rajesh Royal
Rajesh Royal

Posted on

100 Tips from The Pragmatic Programmers Book: Part 6/10

6.1. Don't Pay Inheritance Tax.

Consider alternatives that better fit your needs, such as interfaces, delegation, or mixins

 

6.2. Prefer Interfaces to Express Polymorphism.

Interfaces make polymorphism explicit without the coupling introduced by inheritance.

 

6.3. Delegate to Services: Has-A Trumps Is-A.

Don’t inherit from services: contain them.

 

6.4. Use Mixins to Share Functionality.

Mixins add functionality to classes without the inheritance tax. Combine with interfaces for painless polymorphism.

 

6.5. Parameterize Your App Using External Configuration.

When code relies on values that may change after the application has gone live, keep those values external to the app. When you application will run in different environments, and potentially for different customers, keep the environment and customer specific values outside the app.

 

6.6. Analyze Workflow to Improve Concurrency.

Exploit concurrency in your user’s workflow.

 

6.7. Shared State Is Incorrect State.

Shared state opens a large can of worms that can often only be fixed by rebooting.

 

6.8. Random Failures Are Often Concurrency Issues.

Variations in timing and context can expose concurrency bugs, but in inconsistent and irreproducible ways.

 

6.9. Use Actors For Concurrency Without Shared State.

Use Actors to manage concurrent state without explicit synchronization.

 

6.10. Use Blackboards to Coordinate Workflow.

Use blackboards to coordinate disparate facts and agents, while maintaining independence and isolation among participants.

 
Thanks for reading, happy coding 😀

Top comments (0)