Single Responsibility Principle

Why Trust Techopedia

What Does Single Responsibility Principle Mean?

The single responsibility principle (SRP) is part of the “SOLID” acronym for programming principles developed by Robert C. Martin. It relates to each object in a codebase having a single specific function.

Advertisements

Techopedia Explains Single Responsibility Principle

SOLID principles include the single responsibility principle, as well as four other principles that rely on the SOLID acronym: open-closed, Liskov substitution, interface segregation and dependency inversion.

As part of this set, which is meant to simplify code development and extension and help with updates and changes, the single responsibility principle indicates a single function per class and helps with making code modular to prevent interdependencies. Classes and elements that have only one responsibility are easier to explain and easier to understand within a codebase environment. That makes the single function responsibility as part of the SOLID acronym a key way to optimize object-oriented programming.

Advertisements

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.