Computer ScienceChapter 73 min read

Software Engineering — Principles of Good Code and Good Projects

O
OIYO EditorialContributor
7/10

Software Development Lifecycle (SDLC)

Requirements Analysis → Design → Implementation → Testing → Deployment → Maintenance

Key methodologies:

  • Waterfall: complete each phase sequentially (best when requirements are clear)
  • Agile: short sprints, rapid feedback (best when requirements change often)
  • DevOps: integrate development + operations, CI/CD automation

Object-Oriented Programming (OOP) — 4 Pillars

Encapsulation:

  • Bundles data and methods into a single unit
  • Hides internal implementation (private)
  • Exposes only the public interface (public)

Inheritance:

  • Reuses properties and methods of a parent class
  • Reduces code duplication, IS-A relationship

Polymorphism:

  • Same interface, different implementations
  • Overriding: a child class redefines a parent method

Abstraction:

  • Hides unnecessary implementation details
  • Implemented via interfaces / abstract classes

SOLID Principles

Five principles for good object-oriented design:

S — Single Responsibility Principle:

  • A class should have only one reason to change
  • “Is this class doing too many things?”

O — Open/Closed Principle:

  • Open for extension, closed for modification
  • Adding new features should minimize changes to existing code

L — Liskov Substitution Principle:

  • A subclass must be substitutable for its parent class

I — Interface Segregation Principle:

  • Don’t force clients to depend on methods they don’t use
  • Split large interfaces into smaller, focused ones

D — Dependency Inversion Principle:

  • High-level modules must not depend on low-level modules
  • Both should depend on abstractions (interfaces)

Design Patterns

Proven solutions to recurring design problems:

Creational Patterns:

Singleton:ensures only one instance exists (e.g., DB connection)
Factory:separates object creation logic
Builder:constructs complex objects step by step

Structural Patterns:

Adapter:converts incompatible interfaces
Decorator:dynamically adds functionality
Proxy:controls access via a surrogate object

Behavioral Patterns:

Observer:event subscription / publication (pub/sub)
Strategy:encapsulates algorithms so they can be swapped
Command:encapsulates a request as an object

Types of Testing

Unit Test:

  • Tests a single function or method
  • Fast and isolated
  • TDD: write the test first, then implement the code

Integration Test:

  • Tests multiple components working together
  • Verifies interactions with databases and external APIs

End-to-End (E2E) Test:

  • Tests complete user scenarios
  • Slow but the most realistic

Test Pyramid:

Unit (many, fast) > Integration (medium) > E2E (few, slow)


Version Control (Git)

Essential commands:

git init / clone:initialize or clone a repository
git add / commit:stage and commit changes
git push / pull:sync with the remote repository
git branch / checkout:manage branches
git merge / rebase:merge branches

Branching strategy (Git Flow):

main:stable, deployable version
develop:integration branch for ongoing development
feature/*:individual feature branches
hotfix/*:emergency bug fixes

Key Takeaways

OOP 4 pillars: Encapsulation, Inheritance, Polymorphism, Abstraction SOLID: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion Design patterns — 3 categories: Creational (Singleton), Structural (Adapter), Behavioral (Observer) Test pyramid: Unit (many) > Integration > E2E (few)

O

OIYO Editorial

Editorial Desk

The OIYO editorial desk researches money, law, lifestyle, and self-understanding topics against primary sources and public statistics. Every piece carries source notes and is reviewed on a regular cycle for accuracy and usefulness.