I am reading great book at the moment titled Clean Architecture A Craftsman’s Guide to Software Structure and Design and I ask myself, is there anything I can apply from this book… i think the answer is yes! As ServiceNow professionals, can we learn anything from Single Responsibility Principle for example? I think yes again.
But first, what is Single Responsibility Principle?
Single Responsibility Principle is part of SOLID principles which tell us how to arrange our functions and data structures into classes, and how those classes should be interconnected.
The argument for the single responsibility principle is relatively simple: it makes your system easier to implement and prevents unexpected side-effects of future changes.
What is responsibility in the context SRP?
It refers to the purpose and area of concern of your abstraction encompasses . I think about like this in the context of ServiceNow – that’s your:
- Script include
- Flow designer
- UI Policy
- Client Script
- Widget
example: a client script that validates phone numbers can be said to have a singular responsibility. A client script that both validates and normalizes those numbers with their country codes, however, can be said to have two responsibilities. According Single Responsibility Principle would, we need to split those into two separate ones.
for more about Clean Architecture please have a look at Robert C.Martin book