Tiven Wang
Wang Tiven October 16, 2017
425 favorite favorites
bookmark bookmark
share share

The Single Responsibility Principle (SRP) is a computer programming principle that states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility. Robert C. Martin expresses the principle as, “A class should have only one reason to change.”[1]

分而治之 (Divide and Conquer)策略讲的是把大的问题分割成更小的问题,进而找到每个小问题的方位和责任。通过这种责任划分的过程你可以更轻松的解决看似很庞大的但具有层级结构的问题。这就涉及到划分到什么程度才是合适的,SRP给出的答案是每个task(e.g. modular, class)应该具有完整的不可分割的单独的责任,或者用 Robert C. Martin 的话说,”一个类应该只有一个改变的理由。”。

Applying SRP in Reactive Application

S.O.L.I.D.

http://aspiringcraftsman.com/2011/12/08/solid-javascript-single-responsibility-principle/

https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa

References

Similar Posts

  • Testing Reactive Applications How to verify that the Reactive applications you build are elastic, resilient, and responsive. Testing is covered first because of the importance of proving Reactive capabilities. Just as Test-Driven Design (TDD) allows you to ensure that you are writing logic that meets your requirements from the outset, you must focus on putting into place the infrastructure required to verify elasticity, resilience, and responsiveness.
  • Stream Processing Stream processing is a computer programming paradigm, equivalent to dataflow programming, event stream processing, and reactive programming, that allows some applications to more easily exploit a limited form of parallel processing. The stream processing paradigm simplifies parallel software and hardware by restricting the parallel computation that can be performed. Given a sequence of data (a stream), a series of operations (kernel functions) is applied to each element in the stream.
  • Reactive Design Patterns Reactive Design Patterns
  • Reactive Design Patterns - Spring Boot Messaging
  • Reactive Design Patterns - Analyzing Latency of Traditional Approach
  • Reactive Design Patterns - Reactive Manifesto 以响应式系统方式构建的系统更加灵活,松耦合和可扩展。这使得它们更容易被开发,而且经得起变化的考验。它们对于系统失败表现出显著的包容性,并且当失败真的发生时,它们能用优雅的方式去应对,而不是放任灾难的发生。响应式系统是高度灵敏的,能够给用户以有效的交互式的反馈。

Comments

comments powered by Disqus
Back to Top