Category: SOLID

  • Clojure Multimethods: The Open Closed Principle

    Clojure Multimethods: The Open Closed Principle

    Bertrand Meyer’s Open Closed Principle states that adding new behavior shouldn’t change existing code. It should only extend code. Clojure has a great form for that: The Multimethod For example, here’s a data store similar to RedisĀ®. You can run commands like: That works fine. But now, we want to implement an “ECHO” command: And…