Single Responsibility Principle

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s