Skip to main content

Software Engineering

Overview

Covers software engineering principles, SDLC methodologies, design patterns, clean code, and testing — based on the HKUST Software Engineering Specialization and HackerRank Certified Software Engineer.


SDLC Models

ModelDescriptionBest For
WaterfallSequential phases, no going backFixed requirements
AgileIterative sprints, adaptiveEvolving requirements
ScrumAgile framework with sprints, ceremoniesProduct development
KanbanContinuous flow, WIP limitsOperations/support
DevOpsDev + Ops + CI/CD pipelineCloud-native teams

Design Patterns

Creational

  • Singleton — one instance globally (e.g., Logger, Config).
  • Factory Method — delegate instantiation to subclasses.
  • Builder — step-by-step construction of complex objects.

Structural

  • Adapter — bridge incompatible interfaces.
  • Decorator — add behaviour without modifying class.
  • Proxy — control access to an object.

Behavioural

  • Observer — subscribe/notify pattern (event systems).
  • Strategy — swap algorithms at runtime.
  • Command — encapsulate a request as an object.

SOLID Principles

LetterPrinciple
SSingle Responsibility — one reason to change
OOpen/Closed — open for extension, closed for modification
LLiskov Substitution — subtypes replaceable for base type
IInterface Segregation — prefer specific interfaces
DDependency Inversion — depend on abstractions

Clean Code

  • Meaningful names — getUserById not getU.
  • Small functions — do one thing, do it well.
  • No magic numbers — use named constants.
  • DRY — Don't Repeat Yourself.
  • YAGNI — You Aren't Gonna Need It (no speculative features).
  • Comments explain why, not what (code should be self-explanatory).

Testing

TypeScopeTool
UnitSingle function/classJUnit, Vitest, pytest
IntegrationMultiple componentsSpring Boot Test, Testcontainers
E2EFull user flowCypress, Playwright
PerformanceLoad and stressJMeter, Gatling

Test pyramid: Many unit tests → fewer integration tests → fewer E2E tests.

TDD (Test-Driven Development):

  1. Write a failing test (Red)
  2. Write minimum code to pass (Green)
  3. Refactor (Refactor)

Version Control & Code Review

  • Small, focused commits with descriptive messages.
  • Feature branches + Pull Requests for all changes.
  • Code review checklist: correctness, readability, security, tests, performance.
  • Semantic versioning: MAJOR.MINOR.PATCH.

Cheat Sheet

SOLID: SRP | OCP | LSP | ISP | DIP
Patterns: Singleton | Factory | Builder | Observer | Strategy | Decorator
Testing: Unit → Integration → E2E (pyramid)
Clean code: Meaningful names | Small functions | DRY | YAGNI