Published Feb 5, 2017

Clean Code - How to Write Classes the Right Way

Delve into the intricacies of clean code with Joe Zack and team as they unpack the essentials of class design, SQL performance optimization, and code testability. Explore advanced indexing in SQL, dependency inversion for cleaner code, and the SOLID principles to elevate your coding standards.
Episode Highlights
Coding Blocks logo

Popular Clips

Episode Highlights

  • Inversion Techniques

    Dependency inversion is a key principle in creating flexible and testable code. explains that by pulling dependencies out of methods and passing them as parameters, developers can avoid hardcoding dependencies like database connections directly into their methods. This approach allows for greater flexibility, as dependencies can be swapped out easily, making the code more adaptable to different environments and easier to test 1. adds that dependency inversion doesn't require a framework; developers can start by simply passing dependencies as parameters, which enhances code reusability and testability 2.

    Dependency inversion is not dependency injection, but it is important to point out that with dependency inversion that you want abstractions and not concrete details.

    ---

    This principle encourages the use of abstractions, allowing for more versatile and maintainable code.

       

    Testable Code

    Making code more testable naturally leads to increased reusability and cleaner design. highlights that testable code allows developers to identify and remove unnecessary dependencies, thereby enhancing the code's flexibility and reusability 3. shares a personal experience where abstracting code into testable units improved its design and future usability 3.

    If you think how can I write something that would allow me to test this feature, this functionality that I'm doing, then that almost forces you to break it into a way that is more reusable in the future.

    ---

    By focusing on testability, developers can create more robust and adaptable code structures.

Related Episodes