Overusing Implicit Returns In Software Engineering
Overusing implicit returns makes code harder to read and debug, reducing readability, hiding logic, and causing debugging difficulties. Use explicit returns instead.
Learn something new every day. - I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Overusing implicit returns makes code harder to read and debug, reducing readability, hiding logic, and causing debugging difficulties. Use explicit returns instead.
AI-generated code outperforms lazy programmers. Software jobs decline, but centaurs (developers mastering AI) will survive. Humans remain invaluable when harnessing AI effectively.
Replace global variables with dependency injection to improve testability and reduce coupling. Identify global vars, create abstractions, pass dependencies explicitly, refactor code, and remove original declarations.
Replace rigid inheritance with flexible object delegation to avoid Liskov substitution violation, tight coupling and improve reusability.
Avoid combining Visitor pattern with instanceof checks, it breaks separation and leads to fragile design. Use polymorphism instead, favor encapsulation and keep code clean & maintainable.
Quantum computing revisited 25yrs later! From "magic boxes" to exponentially faster calcuations. Explained in 5 levels: child, beginner, intermediate, advanced & expert. Implications for crypto, multiverse theories & Google's "quantum supremacy".
Avoid using private methods in parent classes with names that child classes can use, as it leads to confusion and unexpected behavior. Use protected or abstract methods instead to maintain clear naming and avoid overlapping names.
Build great software by following these rules: keep a bijection to real entities, avoid null, accidental IFs, setters & getters, coupling, meta-programming, dynamic code generation, choose meaningful names, build a theory, and refactor wisely.
Functions with unclear names confuse readers, increase cognitive load and reduce readability. Use descriptive, action-oriented names to convey intent and simplify communication.
Eliminate unused functions, constants and "just-in-case" code to improve clarity, reduce complexity and maintainability.
Replace static functions with object interactions to reduce coupling, improve testability and cohesion.
Avoid duplicate email validations by creating an `EmailAddress` class to encapsulate validation rules and refactoring code to use it instead of raw strings.
Treat unknown responses as unauthorized, not valid. Defaults can sink you: security risks, error misinterpretation & exploitation potential. Validate all responses, default to unauthorized & log unexpected cases for analysis.
GOTO statements create chaotic code, making logic unclear & debugging harder. Replace with structured programming to improve readability & maintainability. Simplify control flow & avoid unnecessary jumps.
Don't optimize loops without clear need & evidence. Prioritize readability, keep it simple and refactor when needed. Premature optimization hurts eyes and code maintainability.
Don't write regex without tests! Use clear & concise regular expressions, test them thoroughly to avoid unexpected errors & security issues.
Replace mutable attributes with sets for simpler state management and reduced complexity
Streamline API tests by focusing on primitive steps, not direct requests. Reduce unnecessary calls, slow performance & overcomplicated validations.
The Hollywood Principle promotes loose coupling by inverting control, allowing high-level components to decide when & how to use low-level components.
Eliminate mutability by passing essential attributes during object creation, reducing need for getters and setters.
Ditch loops, favor declarative style. Write cleaner code with sum(), reduce() and other high-level functions. Less clutter, more readability.
Favor immutability to prevent unexpected changes caused by aliasing. Immutable objects ensure predictability, reduce bugs & improve thread safety.
Use immutable collections to prevent unintended side effects, debugging challenges & data corruption. Immutable collections can't be changed after creation, helping you avoid aliasing issues.