Published Sep 5, 2014

Behavioral Patterns Pt 1

    Dive into the world of behavioral design patterns as the hosts of Coding Blocks bring humor and personal anecdotes to explore Template, Strategy, and Null Object patterns, while highlighting the pivotal role of listener feedback in shaping their podcast identity.
    Episode Highlights
    Coding Blocks logo

    Popular Clips

    Episode Highlights

    • Template Pattern

      The Template Pattern, also known as the Hollywood principle, is a design pattern that provides a consistent algorithmic framework while allowing specific steps to be customized. Joe Zack explains that it involves an abstract class with a main method that dictates the flow of operations, such as initializing a game or making a move, which can be overridden by subclasses 1. Alan Underwood appreciates the pattern's ability to maintain a consistent structure while allowing for specific behavioral changes 2. However, Joe warns of its potential for overuse, as it can lead to excessive abstraction and complexity in projects 3.

         

      Strategy Pattern

      The Strategy Pattern encapsulates algorithms within classes, allowing for dynamic interchangeability and flexibility in software design. Joe Zack describes it as encapsulating a family of algorithms into classes, enabling the swapping of these classes to execute different algorithms while maintaining a common interface 4. This pattern is particularly useful in scenarios like payment processing, where different methods can be abstracted into separate classes 5. Alan Underwood highlights its utility in ensuring that the client does not need to be concerned with the specific implementation details, thus promoting cleaner and more maintainable code 6.

         

      Null Object Pattern

      The Null Object Pattern simplifies code by abstracting away null checks, providing a safe default implementation that does nothing. Alan Underwood emphasizes its ability to reduce code complexity by eliminating the need for numerous null checks, thus enhancing readability and safety 7. Joe Zack notes that this pattern allows methods to return a safe object instead of null, preventing potential system crashes 8. The pattern pays homage to the concept of null references, a significant yet problematic invention in programming history, as acknowledged by its creator, Sir Charles Anthony Richard Hoare 9.

    Related Episodes