Catalog / Software Engineering Principles Cheatsheet
Software Engineering Principles Cheatsheet
A quick reference guide covering fundamental software engineering principles, methodologies, and best practices. This cheat sheet is designed to help software engineers at all levels in designing, developing, and maintaining high-quality software.
Core Principles
SOLID Principles
S - Single Responsibility Principle (SRP): Example: |
O - Open/Closed Principle (OCP): Example: |
L - Liskov Substitution Principle (LSP): Example: |
I - Interface Segregation Principle (ISP): Example: |
D - Dependency Inversion Principle (DIP): Example: |
DRY Principle
Don’t Repeat Yourself (DRY): Benefits:
Example: |
KISS Principle
Keep It Simple, Stupid (KISS): Benefits:
Example: |
YAGNI Principle
You Ain’t Gonna Need It (YAGNI): Benefits:
Example: |
Design Patterns
Creational Patterns
Singleton |
Ensures only one instance of a class is created and provides a global point of access to it. |
Factory Method |
Defines an interface for creating an object, but lets subclasses alter the type of objects that will be created. |
Abstract Factory |
Provides an interface for creating families of related or dependent objects without specifying their concrete classes. |
Builder |
Separates the construction of a complex object from its representation, allowing the same construction process to create different representations. |
Prototype |
Specifies the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. |
Structural Patterns
Adapter |
Allows incompatible interfaces to work together. Converts the interface of a class into another interface clients expect. |
Bridge |
Decouples an abstraction from its implementation so that the two can vary independently. |
Composite |
Composes objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions uniformly. |
Decorator |
Dynamically adds responsibilities to an object. Decorators provide a flexible alternative to subclassing for extending functionality. |
Facade |
Provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use. |
Flyweight |
Uses sharing to support large numbers of fine-grained objects efficiently. |
Proxy |
Provides a surrogate or placeholder for another object to control access to it. |
Behavioral Patterns
Chain of Responsibility |
Avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. |
Command |
Encapsulates a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. |
Interpreter |
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. |
Iterator |
Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. |
Mediator |
Defines an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and lets you vary their interaction independently. |
Memento |
Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later. |
Observer |
Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. |
State |
Allows an object to alter its behavior when its internal state changes. The object will appear to change its class. |
Strategy |
Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. |
Template Method |
Defines the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure. |
Visitor |
Represents an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. |
Software Development Methodologies
Agile Methodologies
Overview: |
Key Principles:
|
Popular Agile Frameworks:
|
Scrum
Overview: |
Key Components:
|
Kanban
Overview: |
Key Principles:
|
Waterfall Methodology
Overview: |
Phases:
|
Limitations:
|
Code Quality and Testing
Code Quality Metrics
Cyclomatic Complexity |
Measures the number of linearly independent paths through a program’s source code. Lower values indicate simpler, more testable code. |
Code Coverage |
Measures the extent to which the source code of a program has been tested. Higher coverage generally indicates better testing. |
Maintainability Index |
Calculates an index value that represents the relative ease of maintaining the code. Higher values are better. |
Lines of Code (LOC) |
A simple measure of the size of a program. Can indicate complexity and effort required for maintenance. |
Testing Types
Unit Testing |
Testing individual units or components of a software application. Focuses on verifying that each part of the system works as expected. |
Integration Testing |
Testing the interaction between different units or components to ensure they work together correctly. |
System Testing |
Testing the entire system to ensure it meets the specified requirements. Conducted after integration testing. |
Acceptance Testing |
Testing conducted by end-users or stakeholders to determine whether the system meets their needs and expectations. |
Test-Driven Development (TDD)
Overview: |
Steps:
|
Code Review Best Practices
Key Considerations:
|