Single Responsibility Responsible Principle (SRP)

Single Responsibility Responsible Principle (SRP)

The name itself explaining the concept , the class/module should have handle single unit of work.

Rather than handling multiple components in class/module/functionality.

Benefits :

  • Code becoming understandable
  • Better design
  • Less chance to code become complex (code is less fragile)
Implementation :

For example if we are implementing a login page we need maintain a user information, email notification, Logging exceptions 

Code before SRP 



If you observe above code all the functionalities related to login page included in one interface so we need to break the functionalities into single task.

Let's have a look after implementing Single Responsibility Principle



So at a glance always use a module should have a single reason to change the class/interface/function/module



Comments

  1. What is the casino? - SEPT
    The best septcasino casino online https://jancasino.com/review/merit-casino/ is febcasino the One of the main reasons why people are spending money on a game 출장안마 is 토토 사이트 by having a few options. One of the reasons

    ReplyDelete

Post a Comment

Popular posts from this blog

Self introduction in interview for experienced candidates software - Simple way

SOLID Design Principles Interview questions and answers with Simple Examples