Fact-checked by Grok 2 weeks ago

Single-responsibility principle

The single-responsibility principle (SRP) is a foundational principle stating that a or should have only one reason to change, encapsulating a single responsibility to promote maintainability, reduce coupling, and minimize the risk of unintended side effects during modifications. Originating from concepts of in , as described by Tom DeMarco in his 1978 book Structured Analysis and System Specification, where modules are advised to focus on a single functional bond, the principle was formalized in object-oriented contexts by in the 1990s. Martin emphasized that multiple responsibilities within a single unit lead to fragility, as changes for one purpose can inadvertently affect others, using the guideline: "If you can think of more than one motive for changing a , then that class has more than one responsibility." As part of the broader SOLID principles of object-oriented design— an acronym coined by Michael Feathers in 2004 to summarize Martin's earlier work—SRP encourages developers to separate concerns, such as distinguishing data representation from behavior or from rendering. This separation aligns with earlier ideas from Parnas's 1972 paper "On the Criteria To Be Used in Decomposing Systems into Modules," which advocated decomposing systems based on anticipated changes to enhance and modularity. In practice, applying SRP involves refactoring classes with mixed duties, like splitting a Game class that both manages game state and computes scores into distinct Game and Scorer components, thereby isolating change drivers and improving testability. The principle's impact extends to modern , where it underpins agile practices by facilitating easier evolution of codebases in response to shifting requirements, such as separating logic from calculations to avoid disruptions when rules change. Violations of SRP often manifest as "god classes" handling disparate tasks, leading to higher maintenance costs, while adherence fosters reusable, scalable architectures in languages like , C#, and .

Overview

Definition

The single-responsibility principle (SRP) states that a or in should have only one , which means it should have only one reason to change. This principle emphasizes that each component of a system ought to be focused on a singular to promote and . As articulated by , the principle is captured in the key statement: "A class should have one, and only one, reason to change." Here, "responsibility" is defined as a reason for change, representing a cohesive set of behaviors or operations tied to a single, well-defined purpose within the software's functionality. This ensures that modifications driven by one concern do not inadvertently affect others. The term SRP originates from Robert C. Martin's foundational work on object-oriented design principles, where it serves as the "S" in the acronym for robust .

Rationale

The (SRP) fundamentally aims to reduce by ensuring that each or is responsible for a single aspect of functionality, thereby isolating changes and minimizing the risk of unintended side effects across the system. This isolation makes code easier to maintain, as modifications to one responsibility do not propagate to unrelated parts, facilitating targeted testing and extensions without broad refactoring. By limiting the scope of each component, SRP addresses the inherent growth of in evolving systems, where multifaceted modules often lead to entangled dependencies and increased error rates during updates. SRP strengthens modularity by promoting loose coupling between components and high cohesion within them, aligning elements that change for similar reasons while separating those that do not. Loose coupling arises as modules expose only necessary interfaces, reducing interdependencies and allowing independent development or replacement of parts without affecting the whole. High cohesion ensures that internal logic within a module remains focused and consistent, enhancing overall system coherence and reusability. This modular approach echoes principles of abstraction, where complex internals are hidden behind simple interfaces, making the software more comprehensible and adaptable. In terms of software , SRP mitigates the effects of changes by confining modifications to the module responsible for a particular concern, thereby lowering the incidence of bugs and the costs associated with refactoring. When a single module handles one reason to change, updates driven by evolving requirements—such as business rules or environmental shifts—can be localized, preserving stability in other areas and supporting long-term . This controlled reduces efforts and enables scalable growth, as isolated concerns facilitate easier integration of new features or adaptations to unforeseen demands. The theoretical foundation of SRP draws from established concepts like and , which emphasize partitioning systems to encapsulate volatile elements and isolate distinct functionalities. Information hiding, as articulated in modular decomposition criteria, advocates hiding design decisions within modules to shield the system from their variations, thereby enhancing flexibility and comprehensibility. Similarly, separation of concerns promotes dividing programs into independent parts to address specific issues, reducing overall complexity and enabling focused modifications that align with the principle's goal of singular responsibilities. These underpinnings provide a logical basis for SRP, ensuring that prioritizes stability and clarity in the face of inevitable changes.

Historical Development

Origins in Modular Programming

The roots of the single-responsibility principle trace back to the emergence of and practices in the mid-20th century, which emphasized breaking down complex systems into manageable, independent components to improve maintainability and reusability. In the 1950s and 1960s, early high-level languages like introduced subroutines as a means of , allowing programmers to encapsulate specific tasks within reusable code blocks separate from the main program flow. This approach facilitated the organization of code around distinct functions, reducing complexity in scientific and computations by isolating logical units. Similarly, the development of the language in the early built on these ideas through functions and separate units, promoting by enabling code to be developed, tested, and maintained independently while minimizing interdependencies. A pivotal advancement came in the 1970s with the formalization of principles, particularly through ' seminal work on . In his 1972 paper, Parnas argued that system decomposition should prioritize hiding implementation details behind module interfaces, ensuring that changes to internal aspects of one module do not propagate to others unless necessary. This criterion for modularization directly influenced the idea of assigning narrow scopes to components, laying groundwork for responsibilities confined to specific changes. Concurrently, Constantine's contributions to structured design in the late 1960s and 1970s introduced concepts like and , advocating for modules with high internal —focused on a single, well-defined purpose—and low to external elements. These ideas, detailed in Constantine's collaborative work on , emphasized partitioning systems to separate distinct concerns, enhancing clarity and adaptability in large-scale . Edsger Dijkstra further reinforced these foundations in 1974 by coining the term "separation of concerns," highlighting the need to isolate different aspects of a system to manage complexity effectively, even if perfect separation is challenging. This principle encouraged viewing software as composed of loosely interconnected parts, each addressing a singular facet without overlapping influences. As these modular concepts matured, they transitioned into object-oriented programming during the 1980s. Languages like Smalltalk, developed from the early 1970s but influential in the 1980s, evolved modularity by encapsulating data and behavior within objects, where each class represented a cohesive unit with a focused role, building directly on information hiding to limit change impacts. Similarly, Bjarne Stroustrup's C++, introduced in 1985, extended C's procedural modularity into class-based structures, allowing developers to define responsibilities at the class level through private implementations and public interfaces, thus adapting pre-OOP modular decomposition to support inheritance and polymorphism while preserving single-purpose boundaries.

Formulation in SOLID Principles

The Single-responsibility principle (SRP) was explicitly formulated by Robert C. Martin as the foundational element of the SOLID principles, a set of five object-oriented design guidelines aimed at enhancing software maintainability and flexibility. Martin first detailed the SRP in his 2002 book Agile Software Development, Principles, Patterns, and Practices, dedicating Chapter 8 to it and defining it as follows: "A class should have one, and only one, reason to change." This articulation positioned SRP as the mechanism for ensuring that each module or class is responsible for a single aspect of functionality, thereby minimizing the ripple effects of modifications. The SRP emerged within the broader context of during Martin's work at Object Mentor Inc., the consulting firm he founded in 1998, where these principles were introduced alongside others like the Open-Closed Principle and through conferences, workshops, and internal materials around 1998–2000. These sessions emphasized dependency management in object-oriented systems, with SRP serving as the starting point for responsibilities to support agile development practices. The term itself evolved from Martin's earlier references to "responsibility" in late-1990s talks and writings on and modular decomposition, refining into the precise "single responsibility" phrasing to underscore exclusivity in change drivers. Following its initial publication, the SRP gained wider adoption and refinement in Martin's subsequent works, notably his 2008 book Clean Code: A Handbook of Agile Software Craftsmanship, where he elaborated on its application to functions and classes, stressing that violations lead to brittle code structures. This evolution built briefly on unnamed influences from modular programming's emphasis on , but Martin's framing provided the modern, named formulation tailored to object-oriented paradigms. The mnemonic, grouping SRP with the other principles, was coined around 2004 by Michael Feathers to facilitate their collective reference in discourse.

Core Concepts

Single Reason to Change

The single-responsibility principle (SRP) centers on the "reason to change" as the key criterion for defining a 's responsibility, where a responsibility is understood as a cohesive set of behaviors tied to a single or that might necessitate modifications to the . According to , the originator of SRP, a software should have only one reason to change, meaning it responds to changes driven by a single or function, such as a altering calculations without affecting operational reporting. This actor-based view ensures that changes from one source do not inadvertently impact unrelated functionalities, promoting stability and focused maintenance. To identify multiple responsibilities within a module, developers assess whether distinct actors or requirements could independently trigger changes, such as a class that both persists data to a database (driven by IT infrastructure needs) and renders user interfaces (driven by design team updates). For instance, an Employee class handling payroll computation for financial oversight, data storage for technical administration, and hours reporting for operational management violates SRP by accommodating three separate reasons to change, each from different organizational actors like the CFO, CTO, and COO. Criteria for detection include examining method purposes: if methods serve divergent business rules or technical concerns that evolve separately, the module likely harbors multiple responsibilities, increasing the risk of ripple effects during updates. A practical for breaking down responsibilities, as articulated by , is to "gather together the things that change for the same reasons, and separate those things that change for different reasons," which guides refactoring by aligning with anticipated change drivers. Complementary analysis techniques, such as noun-verb decomposition in object-oriented design, further aid this by identifying nouns as potential classes or entities and verbs as actions or responsibilities, helping to isolate singular behavioral units tied to one change reason. Common pitfalls in applying the "single reason to change" include conflating superficially related but distinct responsibilities, such as embedding logging mechanisms within core business logic; while both support execution, logging changes (e.g., switching log formats or providers) arise from operational monitoring needs, whereas business logic evolves from domain requirements, leading to unnecessary recompilations or tests when only one aspect updates. This confusion often stems from viewing cross-cutting concerns like logging as integral rather than separable, resulting in tightly coupled modules that defy the principle's intent for independent evolution.

Separation of Concerns

The (SoC) is a foundational in that involves dividing a into distinct sections, each focused on addressing a specific aspect or "concern" of the system's functionality, thereby simplifying design, implementation, and maintenance. This approach minimizes the interdependencies among components, allowing developers to manage complexity by isolating changes to individual concerns without affecting others. The single-responsibility principle (SRP) represents a -level application of , where each is designed to encapsulate only one primary responsibility, ensuring that modifications for a particular reason—such as the "single reason to change" metric—do not propagate across unrelated parts of the codebase. By adhering to this , SRP promotes modular code that aligns with broader goals, reducing and enhancing at the object-oriented level. SoC can be applied across multiple layers of in , ranging from method-level separation—where individual functions handle narrowly defined tasks—to class-level and module-level divisions, where larger units like packages or namespaces isolate higher-order concerns such as data persistence or logic. This hierarchical application enables scalable system organization, with finer-grained separations supporting detailed control and coarser ones facilitating architectural boundaries. To enforce these boundaries, common mechanisms include the use of interfaces to define contracts that abstract implementation details, delegation to transfer specific responsibilities to collaborating objects, and composition to assemble complex behaviors from simpler, independent components rather than relying on inheritance hierarchies. These techniques reduce unintended interactions and support the principle's objectives by clearly delineating responsibility scopes. Theoretically, SoC as operationalized in SRP builds upon the paradigm outlined by and collaborators, which emphasized disciplined of programs into manageable, hierarchically structured units to improve and verifiability. This paradigm laid the groundwork for modern separation strategies by advocating for clear, levels-based organization that anticipates and isolates change.

Applications and Examples

Basic Code Example

To illustrate the single-responsibility principle (SRP), consider a basic example in Java involving employee management, where an initial class violates SRP by handling multiple unrelated tasks: calculating pay and generating reports.

SRP Violation Example

The following class, Employee, combines pay calculation (a financial responsibility) with report printing (a reporting responsibility), meaning it has multiple reasons to change—for instance, updates to pay logic or changes in report formatting would both require modifications to the same class.
java
public class Employee {
    private String name;
    private double hoursWorked;
    private double hourlyRate;

    public Employee([String](/page/String) name, [double](/page/Double) hoursWorked, [double](/page/Double) hourlyRate) {
        this.name = name;
        this.hoursWorked = hoursWorked;
        this.hourlyRate = hourlyRate;
    }

    // Calculates pay (financial responsibility)
    [public](/page/Public) [double](/page/Double) calculatePay() {
        return hoursWorked * hourlyRate;
    }

    // Prints report (reporting responsibility)
    [public](/page/Public) void printReport() {
        System.out.println("Employee: " + name);
        System.out.println("Pay: $" + calculatePay());
    }
}
This design violates SRP because the class responds to more than one actor or concern: financial stakeholders might alter pay computation without affecting reports, while reporting teams could change output formats independently.

SRP Adherence Example (Refactored)

To adhere to SRP, refactor the code by separating concerns into distinct classes: Employee now solely manages and pay , while ReportGenerator handles printing. This ensures each class has only one reason to change.
java
public class Employee {
    private String name;
    private double hoursWorked;
    private double hourlyRate;

    public Employee([String](/page/String) name, [double](/page/Double) hoursWorked, [double](/page/Double) hourlyRate) {
        this.name = name;
        this.hoursWorked = hoursWorked;
        this.hourlyRate = hourlyRate;
    }

    // Sole responsibility: calculate pay
    [public](/page/Public) [double](/page/Double) calculatePay() {
        return hoursWorked * hourlyRate;
    }

    // Getters for use by other classes
    [public](/page/Public) [String](/page/String) getName() { return name; }
    [public](/page/Public) [double](/page/Double) getCalculatePay() { return calculatePay(); }
}

public class ReportGenerator {
    // Sole responsibility: generate and print reports
    public void printReport(Employee employee) {
        System.out.println("Employee: " + employee.getName());
        System.out.println("Pay: $" + employee.getCalculatePay());
    }
}
In this refactored version, changes to report formatting (e.g., switching to output) affect only ReportGenerator, leaving the pay logic in Employee untouched, and vice versa for pay formula updates. This separation aligns with SRP by tying each to a single responsibility, reducing coupling and improving maintainability. A key learning from this example is visually identifying responsibility boundaries in code: look for methods that serve disparate purposes (e.g., computation versus output), and split them to isolate changes.

Practical Implementation in

In larger software architectures, the Single Responsibility Principle (SRP) is often integrated with structural and behavioral to delegate specific responsibilities, thereby maintaining modularity and reducing coupling. For instance, the can encapsulate a complex subsystem behind a simplified interface, ensuring that the facade class handles only coordination while delegating detailed operations to subsystem components, each adhering to SRP by focusing on a single aspect of the functionality. Similarly, the allows algorithms to vary independently by encapsulating them in separate classes, where each strategy class manages one behavioral variant, isolating changes related to that behavior from the context class that uses it. The complements SRP by treating individual operations as objects, enabling each command class to encapsulate a single action and its execution details, which separates the invoker from the receiver and limits change propagation to the affected command. These integrations promote high within classes while minimizing unintended side effects across the system. Refactoring existing code to enforce SRP involves techniques such as Extract Class and Move Method, as outlined in Robert C. Martin's refactoring practices. The Extract Class refactoring addresses classes that violate SRP by handling multiple responsibilities, such as and . The step-by-step process includes: (1) identifying distinct responsibilities within the by analyzing methods and fields that relate to different concerns; (2) creating a for one of the extracted responsibilities, defining appropriate fields and methods; (3) moving relevant fields and private methods to the using Move Field and Move Method; (4) updating the original to reference the via or ; and (5) testing to ensure remains unchanged. Move Method, applied when a method better suits another , follows similar steps: (1) determine the target where the method logically belongs; (2) copy the method to the target , adjusting parameters if needed; (3) update callers to invoke the method on the target instance; (4) remove the original method; and (5) verify through tests. These techniques, when applied iteratively, transform monolithic classes into focused ones, aligning with SRP's goal of single reasons for change. A practical of SRP application appears in the design of a .NET-based for order processing, where responsibilities like and are separated to enhance . In this architecture, identity-related logic is handled by the IIdentityService interface for tasks such as verification, independent of validation behaviors that focus on business rules for order , such as checking stock levels and payment details using FluentValidation. This separation is implemented in the application's command handlers within an , where each handler processes one command type (e.g., CreateOrderCommand), delegating validation via behaviors and identity checks to IIdentityService before execution. The result is reduced complexity in the controller layer, which now only orchestrates calls without embedding logic, allowing changes to policies (e.g., adding multi-factor support) to occur without impacting validation rules or vice versa. Success in applying SRP can be measured using scores and . is quantified via the Lack of of Methods (LCOM) , where lower values indicate higher intra-class cohesion and adherence to SRP, as methods relate closely to a single responsibility; for example, LCOM4 in calculates this by assessing shared field usage across methods, flagging classes with values above 1 as potentially violating SRP. evaluates how modifications in one module affect others, with SRP-optimized designs showing localized impacts; tools like integrate this by tracing dependencies and predicting ripple effects, where high SRP compliance correlates with fewer affected components during refactors. Industrial studies of SRP-driven refactorings have shown improvements in , such as up to 128% enhancement in cohesion and at the method level.

Benefits and Limitations

Advantages

Adhering to the Single Responsibility Principle (SRP) significantly enhances software by confining changes to isolated components, thereby simplifying and updates without unintended side effects across the system. This isolation reduces the on developers when modifying code, as each class or module focuses on a singular concern, minimizing the ripple effects of alterations. The principle also improves testability by enabling the creation of focused unit tests for smaller, cohesive units of code, which lowers overall test complexity and increases coverage efficiency. With responsibilities segregated, tests can target specific behaviors without the need for extensive mocks or setups, leading to more reliable and maintainable test suites. Reusability is another key advantage, as components designed with a single purpose become more modular and interchangeable, allowing them to be applied across diverse projects or contexts without modification. This modularity promotes the development of libraries and frameworks that leverage well-defined, purpose-specific elements. SRP supports in large-scale by facilitating team collaboration, where different developers or teams can own distinct responsibilities without overlapping dependencies, streamlining parallel work and integration. underscores these benefits; for instance, a on two industrial systems with a combined total exceeding 1,500 classes demonstrated that applying SRP improved through better and metrics. Additionally, an of a prototype showed SRP reduced by approximately 69% and increased by 29%, contributing to overall enhancements. In experiments involving 100 data scientists, SRP adherence led to statistically significant improvements in perceived and code understanding (p < 0.01, effect sizes 1.46–1.86).

Challenges in Application

Applying the Single Responsibility Principle (SRP) can introduce several practical challenges, particularly in balancing modularity with overall system coherence. One common issue is over-decomposition, where developers split functionalities into excessively small classes, resulting in code fragmentation and increased complexity. This often leads to "anemic" models, in which domain objects primarily serve as data containers without meaningful behavior, complicating maintenance and violating the intent of encapsulating related logic. Another difficulty arises from ambiguity in defining responsibility boundaries, especially in complex domains where a "single" reason to change may be subjective or interdependent with other components. For instance, distinguishing between core business logic and supporting utilities can lead to inconsistent designs, making it hard to determine the appropriate without hindsight. Performance overhead is a further concern, as SRP's emphasis on delegation and indirection—such as routing calls through multiple classes—can introduce minor runtime costs through additional method invocations and object creations. While these are typically negligible in most applications, they become problematic in performance-sensitive contexts like scientific computing or systems. Retrofitting SRP into legacy codebases presents significant hurdles, as monolithic structures often entwine multiple responsibilities, necessitating extensive refactoring that may disrupt existing functionality and introduce risks without immediate gains. This process can be resource-intensive, particularly in large-scale systems where interdependencies are deeply embedded. To mitigate these challenges, practitioners often apply the YAGNI ("You Ain't Gonna Need It") principle, which advises against premature decomposition by implementing splits only when a demonstrated need arises, thereby avoiding over-engineering while preserving SRP's benefits in maintainability.

Integration with SOLID

The Single-responsibility principle (SRP) forms a cornerstone of the principles, introduced by , by establishing focused modules that underpin the interdependence among the suite's elements. Specifically, SRP enables the Open-Closed Principle (OCP) by isolating individual responsibilities within classes, allowing extensions—such as adding new behaviors via polymorphism—without necessitating modifications to existing code, thereby reducing fragility and promoting stability in evolving systems. This isolation confines changes to targeted areas, aligning with OCP's goal of openness for extension while closure for modification. SRP also supports the (LSP) through its emphasis on singular, well-defined behaviors, ensuring that subclasses can replace base classes without disrupting program correctness or introducing unexpected side effects. When classes adhere to SRP, their contracts remain narrow and predictable, facilitating behavioral where derived classes preserve the focused invariants of their parents; in contrast, multifaceted responsibilities obscure these contracts, increasing the likelihood of failures. In practical application, SRP is typically applied first within the SOLID sequence to delineate clear responsibility boundaries, creating cohesive units that serve as a prerequisite for implementing the (). This foundational step ensures that subsequent abstractions for —where high-level modules depend on low-level ones via interfaces rather than concretions—are built upon stable, single-purpose components, avoiding entangled dependencies that complicate inversion. Breaches of SRP often precipitate broader violations, illustrating the need for holistic adherence. For example, a responsible for both data and in a communication becomes resistant to extension: adding a new logging mechanism requires altering the modulation logic, violating , while subclassing for specialized modulation may inadvertently alter logging behavior, breaching LSP and rendering substitutions unreliable. Such entanglements amplify maintenance costs and hinder adaptability. The evolution of , with SRP as its starting point, has been deeply intertwined with since the early 2000s, when formalized these principles in his essay "Design Principles and Design Patterns." Integrated into through his 2002 book Agile Software Development, Principles, Patterns, and Practices, SRP and its companions have been taught as tools for fostering responsive, refactorable codebases that align with agile's emphasis on iterative change and .

Comparison to Other Design Patterns

The Single-responsibility principle (SRP) differs from the (DRY) principle in its core focus: while DRY emphasizes avoiding code duplication across a system to reduce maintenance overhead, SRP targets the separation of responsibilities within a single module or class to ensure it changes for only one reason. For instance, a class handling both and user notification violates SRP by having multiple change triggers (e.g., updates or UI changes), even if the code is not duplicated; DRY would only flag issues if similar validation logic appears elsewhere. This distinction highlights SRP's role in promoting internal cohesion over mere reuse, though the principles can complement each other in modular designs. In contrast to the (LoD), which restricts object interactions to minimize dependencies and by limiting knowledge of internal structures (e.g., an object should not reach into another's internals), SRP emphasizes a class's singular without directly addressing inter-object boundaries. Violating LoD can indirectly breach SRP if it forces a class to adapt to changes in distant objects, creating multiple reasons for modification, but SRP applies more broadly to a class's overall duties rather than interaction chains. For example, a multiple object accesses (e.g., user.getAddress().getStreet().getNumber()) adheres to SRP if the class's sole role is address retrieval but risks fragility under LoD. Thus, LoD supports SRP by encapsulating behaviors, but they operate at different levels: versus encapsulation of dependencies. SRP aligns with the Model-View-Controller (MVC) pattern by reinforcing the separation of data handling (model), presentation (), and orchestration (controller), yet it extends further by scrutinizing responsibilities within each component. In traditional MVC, the model focuses on without UI concerns, embodying SRP, but bloated controllers managing routing, validation, and responses can violate it; SRP advocates delegating such tasks to specialized services. This relation ensures MVC's modularity scales, as SRP prevents controllers from becoming "god objects" that change for diverse reasons like API updates or validation rules. When viewed through (FP) paradigms, SRP in (OOP) translates to designing classes with singular mutable state or behavior, whereas FP achieves analogous separation via pure, composable functions that avoid side effects and maintain . In OOP, SRP might refactor a class handling both computation and I/O into separate ones; in FP, this mirrors the of small, single-purpose tools or functions (e.g., a function solely transforming data without persistence). However, FP's immutability reduces SRP's emphasis on state isolation, prioritizing function purity over class boundaries, which can lead to more granular but composable units in large systems. In large software systems, prioritize SRP when scaling introduces multiple stakeholders or evolving requirements, as it localizes changes and eases testing, outperforming isolated patterns like DRY or LoD that address symptoms rather than foundational modularity. For example, in enterprise applications with distributed teams, SRP facilitates parallel development by assigning classes to specific domains, reducing merge conflicts compared to applying LoD alone, which might overlook intra-class bloat. This prioritization is evident in microservices architectures, where SRP-guided decomposition enhances deployability without over-fragmenting under other principles.

References

  1. [1]
    [PDF] SRP: The Single Responsibility Principle - Texas Computer Science
    Dictionary of Phrase and Fable. 1898. This principle was described in the work of Tom DeMarco1 and Meilir Page-Jones2. They called it cohesion. They defined ...
  2. [2]
    ArticleS.UncleBob.PrinciplesOfOod - ButUncleBob.com
    The Principles of OOD ; SRP, The Single Responsibility Principle'', A class should have one, and only one, reason to change.'' ; OCP, The Open Closed Principle ...
  3. [3]
    The Single Responsibility Principle - Clean Coder Blog - Uncle Bob
    May 8, 2014 · The Single Responsibility Principle (SRP) states that each software module should have one and only one reason to change.Missing: source | Show results with:source
  4. [4]
    [PDF] Design Principles and Design Patterns
    Every fix makes it worse, introducing more problems than are solved. Page 3. Robert C. Martin. Copyright (c) 2000 by Robert C. Martin.
  5. [5]
    [PDF] On the Criteria To Be Used in Decomposing Systems into Modules
    This paper discusses modularization as a mechanism for improving the flexibility and comprehensibility of a system while allowing the shortening of its ...Missing: rationale | Show results with:rationale
  6. [6]
  7. [7]
    [PDF] A Brief History of Modularity in Programming - cs.Princeton
    Title in retrospect! Example languages. • Machine languages. • Assembly languages. • FORTRAN (Formula Translating System). • BASIC ( ...
  8. [8]
    On the Criteria To Be Used in Decomposing Systems into Modules
    Parnas, D. L. On the criteria to be used in decomposing systems into modules. Tech. Rept., Depart.. Computer Science, Carnegie-Mellon U., Pittsburgh, Pa ...Missing: rationale | Show results with:rationale
  9. [9]
    [PDF] Structured Design ISBN 0-917072-11 - vtda.org
    ... Larry L. Constantine. Page 2. STRUCTURED DESIGN. Fundamentals of a Discipline ... separation of data relationships (which show up in the stronger forms of ...
  10. [10]
    E.W. Dijkstra Archive: On the role of scientific thought (EWD447)
    Oct 25, 2010 · Another separation of concerns that is very commonly neglected is the one between correctness and desirability of a software system. Over ...
  11. [11]
    OO Principles - Object Mentor
    Object Oriented Design Principles. The principles of Object Oriented Design and Dependency Management. We've written dozens of papers about these principles ...
  12. [12]
    Single Responsibility Principle Unpacked - Reflectoring
    Feb 26, 2020 · The Single Responsibility Principle applies to the software that we develop on different levels: methods, classes, modules, and services.Types Of Responsibilities · How Small Or Large Should A... · Understandability And...
  13. [13]
    SOLID: Part 1 - The Single Responsibility Principle | Envato Tuts+
    Dec 13, 2013 · Why is it so important to have only one reason for change? In ... An actor for a responsibility is the single source of change for that ...
  14. [14]
    SOLID series: Single Responsibility Principle (SRP) - LogRocket Blog
    Apr 30, 2025 · Common misconceptions and pitfalls of SRP ... A layered architecture, which keeps the user interface, business logic, and data access distinct, is ...
  15. [15]
    When using the Single Responsibility Principle, what constitutes a ...
    Mar 27, 2017 · So to sum up: A "responsibility" is catering to a single business function. If more than one actor could cause you to have to change a class, ...Does logging inside a class violate the SRP?How and to apply Single responsibility principle correctly? [duplicate]More results from softwareengineering.stackexchange.comMissing: pitfalls | Show results with:pitfalls<|control11|><|separator|>
  16. [16]
    Textbook Chapter : Principles - CS2113/T
    Separation of concerns principle (SoC): To achieve better modularity ... This principle can be applied at the class level, as well as at higher levels.
  17. [17]
    Separation of Concerns (SoC) - GeeksforGeeks
    Feb 13, 2024 · Separation of Concerns (SoC) is a fundamental principle in software engineering and design aimed at breaking down complex systems into smaller, more manageable ...Origin of Separation of... · Why is separation of concerns... · SoC for System Design
  18. [18]
    Separation of Concerns - Effective Software Design
    Feb 5, 2012 · Information Hiding, defined by Parnas in 1972, focuses on reducing the dependency between modules through the definition of clear interfaces. A ...
  19. [19]
    Separation of Concerns in Software Design - Alexey Naumov
    Jan 16, 2020 · The separation of concerns (SoC) is one of the most fundamental principles in software development. It is so crucial that 2 out of 5 SOLID ...Cohesion And Coupling · Soc For The System's Design · Repository
  20. [20]
    E.W.Dijkstra Archive: Notes on Structured Programming (EWD 249)
    NOTES ON STRUCTURED PROGRAMMING. by. Prof. dr. Edsger W. Dijkstra. T.H. - Report 70-WSK-03. Second edition April 1970. NOTES ON STRUCTURED PROGRAMMING. by. prof ...
  21. [21]
    Structured Programming : O.-J. Dahl, E. W. Dijkstra, C. A. R. Hoare
    Jan 28, 2021 · This book is the classic text in the art of computer programming. The first section represents an initial outstanding contribution to the understanding of the ...
  22. [22]
    Facade - Refactoring.Guru
    A Facade is a structural design pattern providing a simplified interface to a complex subsystem, including only features clients need.Facade in Java · Facade in PHP · Facade in Python · Facade in C++
  23. [23]
    SOLID Design in C#: The Single Responsibility Principle (SRP)
    In Object-Oriented Programming, the Single-Responsibility Principle (SRP) states that "A class should have one reason to change."
  24. [24]
    Architectural Patterns - Command (action/transaction) - O'Reilly
    The preceding diagram depicts the structure of a command pattern and a sample implementation for a stockbroker application classes.
  25. [25]
    Clean Code: A Handbook of Agile Software Craftsmanship - O'Reilly
    Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin has teamed up with ...
  26. [26]
    Implementing the microservice application layer using the Web API
    The command handler class offers a strong stepping stone in the way to achieve the Single Responsibility Principle (SRP) mentioned in a previous section. A ...
  27. [27]
    Analysis of Lack of Cohesion in Methods (LCOM): A Case Study
    The main purpose of cohesion is to provide the rule that each class should serve a single purpose. Every class should have a single responsibility. In this ...Missing: Principle | Show results with:Principle
  28. [28]
    Applying the Single Responsibility Principle in Industry
    Since SRP is by definition related to modularity, as a success measure for the refactoring we use coupling and cohesion metrics. The results of the study ...<|separator|>
  29. [29]
    [PDF] Investigating the Impact of SOLID Design Principles on Machine ...
    Feb 9, 2024 · Hereafter, we briefly describe each of these principles based on [13]. The Single Responsibility Principle (SRP) advocates that each class.
  30. [30]
  31. [31]
    Anemic Domain Model - Martin Fowler
    Nov 25, 2003 · The basic symptom of an Anemic Domain Model is that at first blush it looks like the real thing. There are objects, many named after the nouns in the domain ...
  32. [32]
    When Using Solid Principles May Not Be Appropriate - Baeldung
    Feb 21, 2025 · Definition. Single Responsibility Principle (SRP), A class ... Favor simplicity over premature optimization, Avoids over-engineering ...
  33. [33]
    [PDF] Scientific Software Design - Argonne National Laboratory
    SOLID Principles Pose Some Difficulties. ❑ Single responsibility. ❑ Class/method/function should do only one thing. ❑ Open/closed. ❑ Open for extension ...
  34. [34]
    [PDF] Object Oriented Design Principles Best Practices in Programming
    Robert C. Martin published in The C++ Report. ○ The Open-Closed ... Martin. ○ Design Principles and Design Patterns. ○ The Single Responsibility Principle. 45.<|control11|><|separator|>
  35. [35]
    SOLID Principles in Object Oriented Design – BMC Software | Blogs
    Aug 26, 2024 · Robert C. Martin developed the SOLID principles in his 2000 essay, “Design Principles and Design Patterns.” Martin acknowledged that ...Missing: origin | Show results with:origin
  36. [36]
    How is DRY principle ( applied at class level ) related to SRP?
    Dec 9, 2013 · DRY will avoid duplicating logic between classes, but it won't prevent putting two or more responsibilities into a single class.Clarify the Single Responsibility PrincipleHow to determine if a class meets the single responsibility principle?More results from softwareengineering.stackexchange.com
  37. [37]
    Simple pictures to explain DRY and SRP - Random Tech Thoughts
    Oct 17, 2019 · The Single Responsibility Principle (SRP) and Don't Repeat Yourself (DRY) are two common principles of good software engineering.
  38. [38]
    Principles of Software Development: SOLID, DRY, KISS, and more
    Jul 1, 2023 · The Single Responsibility Principle (SRP) states that a class should have only one well-defined responsibility. In other words, a class should ...
  39. [39]
    Demeter: It's not just a good idea. It's the law. - avdi.codes
    Jul 5, 2011 · The Law of Demeter, which sets limits on the number of types a single method can interact with, is a heuristic for identifying code that (among ...
  40. [40]
    The Law of Demeter - Nathaniel Saul
    Sep 10, 2017 · “have only one reason for change” - Breaking the Law of Demeter breaks the SRP because when a subobject changes, your object would have to ...
  41. [41]
    Essential Software Design Principles (SOLID) – Must-Knows Before ...
    Definition: The Law of Demeter is a design principle that encourages reducing the coupling between components in a software system. It states that an object ...
  42. [42]
    Lod - Law of Demeter - AlgoMaster.io
    Single Responsibility Principle (SRP): LoD encourages putting logic where it belongs. If OrderService needs pricing logic, LoD nudges you to push it into ...
  43. [43]
    Single responsibility principle in MVC - Stack Overflow
    Jul 5, 2015 · I have a MVC project with following pattern. View <-> Controller <-> Service <-> Repository/Entities <-> Database. For example, if I have 2 ...Does the traditional use of the controller in MVC lead to a violation of ...Single Responsibility Principle in MVC controllers. Critique requiredMore results from stackoverflow.com
  44. [44]
    New MVC: Single Responsibility Principle and Delegation | by Zafar ...
    Having had hands-on experience with MVP, MVVM, and VIPER, I could see a way to improve an MVC design pattern, keeping the nuances of these architectures in mind ...
  45. [45]
    Pattern: Decompose by business capability - Microservices.io
    The SRP defines a responsibility of a class as a reason to change, and states that a class should only have one reason to change. It make sense to apply the SRP ...Missing: over- | Show results with:over-
  46. [46]
    Equivalent of SOLID principles for functional programming
    Sep 19, 2012 · In functional programming, S (SRP) is referential transparency, O (OCP) relates to algebraic data types, L (LSP) is contravariance, D (DIP) ...Is functional programming a superset of object oriented?object oriented - Functional Programming vs. OOPMore results from softwareengineering.stackexchange.com
  47. [47]
    Functional programming vs OOP: comparing paradigms
    Functional programming uses pure functions, while OOP uses classes and objects. OOP stores data in objects, while functional programming passes data through ...
  48. [48]
    Functional Programming vs Object-Oriented Programming in Data ...
    Nov 22, 2023 · Explore two of the most commonly used programming paradigms in data science: object-oriented programming and functional programming.
  49. [49]
    The Single Responsibility Principle Revisited - The Valuable Dev
    Aug 27, 2020 · Another source quoted by Martin as a big inspiration for the SRP is the paper On the Criteria To Be Used in Decomposing Systems into Modules.
  50. [50]
    SOLID Design Principles: The Single Responsibility Explained
    SOLID is an acronym for the 5 design principles of object-oriented programming. This article focuses on the Single responsibility principle.Missing: authoritative | Show results with:authoritative
  51. [51]
    Does Single Responsibility Principle Lead to Bad Architecture?
    Aug 8, 2017 · Is the Single Responsibility Principle the cause of over-architecture? Only if we misunderstand & misquote the SRP.