Software Design/Split responsibilities between classes and functions

From Wikiversity
Jump to navigation Jump to search

Checklist questions:

  • Does a class have a single responsibility?
    • A business logic area
    • An external integration (database, service, API)
    • A domain data object, a builder, or a configuration class for another class
    • An aspect of the program's control flow or data flow, such as an active object, or an object integrating other objects
  • Does a function have a single responsiblity?
    • A single business logic operation
    • A single kind of external operation (e. g. a specific API call or a database operation)
    • An aspect of program's control flow, or a function integration other functions (including higher-order functions)
  • If a function has more than three (3) parameters, couldn't its responsibilities be split between multiple functions?

This practice corresponds to the Single Responsibility Principle, applied on the level of classes.

Why not

[edit | edit source]
[edit | edit source]

See also

[edit | edit source]

Sources

[edit | edit source]