Effective Software Design Practices
Effective Software Design Practices
A Systematic Approach
About the Book
"Effective Software Design Practices: A Systematic Approach" presents essential principles for creating maintainable software systems. This comprehensive guide explores the relationship between architecture and design, introducing Cognitive-Driven Development as a methodology to enhance code comprehension.
The book examines fundamental concepts like the correlation between feature and code complexity, the impact of indirection on system design, and the importance of explicit compilation hints. It emphasizes practical approaches to software development, including state management through reference ownership, API design principles, and encapsulation strategies for improved cohesion.
Special attention is given to automated testing as a critical tool for quality assurance and early bug detection. Through these interconnected topics, readers will gain valuable insights into building robust, efficient, and sustainable software solutions.
Table of Contents
- Why Does This Ebook Exist?
- Important information about the examples
- Architecture vs. Design
- Introduction
- An Architecture for Your Design
- Some Inspirations for Supporting Good Design
- Software Maintainability Remains a Challenge
- Why Does Software Become So Difficult to Maintain?
- Why Current Design Techniques Aren’t Enough
- A New Approach to Managing Code Complexity
- Keep an Open Mind
- Cognitive-Driven Development Helps Software Teams to Keep Complexity Under Control
- Introduction
- What is CDD?
- CDD in a real-life project
- Findings
- Conclusion
- References
- Cognitive-driven Development, DDD, and the Modern Real World
- The Current DDD Landscape
- Modern Frameworks, CDD and DDD
- Now Show Me the Code!
- Conclusion
- Set of techniques for your daily routine
- CDD in existing contexts
- Other design techniques to add to your utility belt
- The highest priority is to work according to the use case
- The second most important thing is that the code be understandable
- So now, do I have to choose for the code to work or to be understandable?
- Execute your code as fast as possible
- Start with the use case’s data input
- Example flow starting with data input
- Each execution is a chance to catch a possible bug earlier
- Is this the best way that exists?
- We always protect system boundaries. Especially the outermost one
- We separate the system’s external boundaries from its core
- The fragility of the established contract
- Generic vs Specific
- Create classes for receiving parameters
- As a bonus we’re even more secure
- My code became more complex
- Don’t serialize domain objects for API responses
- The fragility of coupling
- Creating a representation for the endpoint
- Every Indirection Increases Complexity
- An Example of Code with Almost No Indirection
- We Begin the Journey of Indirections
- The Indirection for the Domain Type
- The Indirection for Persisting Objects
- Is More Concise Code Less Complex?
- Analyzing the Code Through the CDD-Derived Metric
- Is There a Limit to Indirections?
- Final Message About Indirection
- We use the constructor to create the object in a valid state
- What about the id, doesn’t it come through the constructor?
- And why won’t I use accessor methods?
- But the framework needs a no-args constructor
- Leave hints where compilation resolution isn’t possible
- Haven’t I heard that leaving comments or hints is bad?
- Will these metadata validations be executed automatically?
- Well-written code alone is not enough to facilitate understanding
- Our code complexity is proportional to our feature complexity
- We use everything we know that’s ready
- The fear of coupling business with libs and frameworks
- Embrace coupling with everything that’s mature
- Ideally, all written code should be called by someone
- Avoid uncontrolled code generation
- What about when flows are modified?
- We only change the state of references we create
- Modifying external references complicates all state tracking
- As an alternative solution, leave hints that something has changed
- Also leave hints about changes in external systems
- Make the difficulty explicit
- The most efficient version of a dev builds what was agreed upon
- You need to understand exactly what is needed
- Implement what was agreed
- Isn’t a dev an artist?
- You need to understand what you’re using and always look at the negative side of each decision
- The downsides of adopting CDD as a code design approach
- The downsides of using an architectural inspiration with many layers
- The downsides of using a distributed architecture
- Being able to look at points of attention is a constraint
- How many points of attention should I raise?
- Undemocratic APIs
- The danger of unstable contracts
- We need specific and stable interfaces
- Notifying Problems in Your Logic
- Languages with Exceptions as First-Class Citizens
- Languages that DO NOT have Exceptions as First-Class Citizens
- Is There a Line of Thought That Guides Using Exceptions Only for Truly Exceptional Cases, Should I Follow It?
- Conclusion
- We favor cohesion through encapsulation
- Example #1: Object state query logic
- Example #2: Cohesion through encapsulation for object update
- Can an entity access a service?
- Dependency Inversion Principle
- Increased testability
- Possibility of reuse without additional effort
- We create automated tests to help us reveal and fix bugs in the application.
- The potentially risky bet of automated tests
- Why do you think automated testing gives you security for anything?
- Testing techniques so that it’s more revealing of bugs?
- The distortion of code coverage
- Intelligent tests
- The path to a powerful test suite
- Thank You Note
- Why Does This Ebook Exist?
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them