Software Principles Overview

A collection of fundamental principles and philosophies for designing robust, maintainable, and scalable software.

Table of Contents

SOLID Principles

The foundation of Object-Oriented Design (Uncle Bob).

GRASP Principles

General Responsibility Assignment Software Patterns (Larman).

  • Information Expert: Assign responsibility to the class with the information.
  • Creator: Who creates A? Container of A, recorder of A, user of A.
  • Controller: Entry point for a system operation (Facade/Use Case controller).
  • Low Coupling: Minimizing dependencies/impact of change.
  • High Cohesion: Keeping responsibilities focused and manageable.
  • Polymorphism: Handling handling alternatives based on type.
  • Pure Fabrication: Artificial class to maintain cohesion/coupling (e.g., Service).
  • Indirection: Intermediate object to decouple components.
  • Protected Variations: Wrapper around instability/variation points.

General Design Philosophy

Guiding mottos for simple and maintainable code.

Component & Package Principles

How to organize classes into components/packages (Clean Architecture).

Distributed & System Architecture

Principles for building robust, scalable systems.

  • 12-Factor App: A methodology for building software-as-a-service apps.
  • REST Constraints: Architectural style for distributed hypermedia systems.
  • CAP Theorem: Consistency, Availability, Partition tolerance (Pick two).
  • BASE: Basic Availability, Soft state, Eventual consistency.
  • Reactive Manifesto: Responsive, Resilient, Elastic, Message Driven.
  • CQS: Command Query Separation.
  • CQRS: Command Query Responsibility Segregation.

Reliability & Security

Principles for ensuring system stability and safety.

  • ACID: Atomicity, Consistency, Isolation, Durability.
  • Principle of Least Privilege: A subject should be given only those privileges needed for it to complete its task.
  • Defense in Depth: Layering security mechanisms to increase security of the system as a whole.
  • Fail Fast: Systems should stop normal operation rather than attempt to continue a possibly flawed process.

Testing Principles

Guidelines for writing effective tests.

  • F.I.R.S.T: Fast, Independent, Repeatable, Self-Validating, Timely.