DEV Community

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

Posted on

4 1 1 2 1

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 😀

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay