Custom Primitives – Refactoring – Speed – PwP Episode 23

Challenges

  • Simplifying complex logic in software to enhance maintainability.
  • Balancing performance with clean, understandable code.
  • Overcoming technical debt introduced by convoluted or redundant code patterns.

Solutions

  • Refactoring code using custom primitives to encapsulate complex logic.
  • Promoting modular design for better code readability and reusability.
  • Implementing iterative improvements to address inefficiencies and reduce debt.

Benefits

  • Cleaner, more maintainable codebase with reduced complexity.
  • Improved team productivity through simpler and clearer logic.
  • Enhanced performance and scalability in software systems.

Custom primitives, an example of how refactoring accelerates team speed, part of the Clear Measure Way

In this episode, Jeffrey discusses custom primitives, a specific refactoring. Refactoring is one of the engineering practices that increases team speed. Moving fast is part of the Clear Measure Way.

With a refactoring mindset, we modify existing code so that a new change appears as if we had designed it that way since the genesis of the software. We don’t allow something to appear “bolted on”:

  • An Onion Architecture mindset encourages us to push dependencies to the edges and pull core concepts to the center
  • Common operations on primitives clutter the UI, one of the edge interfaces in any application
  • Pulling common operations into the core model of an application limits repetition and reduces concept count
  • Options for refactoring custom usages of primitives
  • C# implicit operators allow the rest of the application to believe our decimal is a normal C# decimal
  • A custom primitive allows the execution of custom logic everywhere while keeping the logic in one place.