A nice post from Google: https://testing.googleblog.com/2023/11/write-clean-code-to-reduce-cognitive.html How Cognitive Load Works Cognitive load refers to the total amount of mental effort being used in the working memory at a given time. Working memory is the part of our brain responsible for holding and manipulating information needed for complex tasks like learning, reasoning, and problem-solving. It has a...Read More
Example 1: Excessive Use of Single Responsibility Principle (SRP) Description Applying the Single Responsibility Principle too strictly can lead to classes and methods that do very little, resulting in an overwhelming number of classes and overly fragmented code. Code Example <?php // Over-engineered example with too many small classes. class UserValidator { public function validateEmail(string $email):...Read More
Symptom 1: Lack of Clarity and Direction It’s shown when the team doesn’t know from where to start and they’re not sure if it’ll work well. Root Cause: When a team is unsure where to start implementing a new feature, it often signals a lack of clear architectural design and modularization. This can be due to:...Read More
Understanding the Problem: In my previous role, the team faced the challenge of adding new parameters to existing log classes. This issue often arises due to a lack of clear structure, flexibility, and maintainability in the logging system. Applying Domain-Driven Design (DDD): DDD can provide a structured approach to address this problem by: Defining the Domain:...Read More