在设计过程中以 SOLID 原则思考

Thinking in SOLID principle during the design process

我是 SOLID 原理和设计的新手,我了解原理但是,我很难知道从哪里开始设计过程。我明白设计是一个迭代的过程,在设计过程中你问自己什么步骤或问题,使你的设计符合 SOLID。

尝试测试驱动开发。在面向对象的上下文中,您通常必须明确考虑 Open Closed Principle, the Dependency Inversion Principle, and the Liskov Substitution Principle 以使您的被测系统具有可测试性和确定性。

还有其他方法可以使 API 可测试。例如,如果您正在使用函数式编程,pure functions are intrinsically testable。在那种情况下,您不需要明确考虑 SOLID。