Skip to content
Yash Dabas
All work
05
Systems
2022

EmployeeManagement

Object-oriented design and data structures in C++

Role
Developer: architecture and implementation
Year
2022
Discipline
C++ · Data Structures · Object-Oriented Design
Context
A console-based employee records system in C++, built from first principles.
Overview

Building this against a database and an ORM would have made it a configuration exercise. Building it in C++ with nothing underneath made it a design exercise, which was the point.

Records, search, sorting, persistence and lifetime are all handled explicitly. Every abstraction that a modern stack provides for free had to be chosen, implemented and justified, which is the fastest way to understand why those abstractions exist.

The problem

What madethis hard.

  • 01

    Ownership has to be decided, not assumed

    Without a garbage collector, every object's lifetime is a design decision. Getting it wrong produces leaks or dangling references rather than a slightly slower program.

  • 02

    Persistence without a database

    Records outlive the process, so serialisation, format versioning and corruption handling all become the program's responsibility.

  • 03

    Different employee types, shared operations

    Salaried, hourly and contract staff differ in how they are paid but must be storable, searchable and sortable through one interface.

  • 04

    Search and sort at usable speed

    Linear scans are acceptable at ten records and unacceptable at ten thousand. The access patterns dictate the data structures.

The approach

How Isolved it.

  1. 01

    Polymorphic hierarchy over a common base

    An abstract Employee base with virtual dispatch for type-specific payroll behaviour, so the collection stores one type and the correct logic resolves at runtime.

  2. 02

    RAII and smart pointers

    Resource lifetimes bound to scope with ownership expressed in the type system, eliminating manual delete calls and the leaks that follow them.

  3. 03

    STL containers chosen by access pattern

    Hash-based lookup for identifier access, ordered containers where iteration order matters. The structure follows the query, not habit.

  4. 04

    Versioned file persistence

    A serialisation format carrying a version header, with validation on load so a truncated or malformed file is rejected rather than partially trusted.

  5. 05

    Operator overloading with restraint

    Comparison operators defined where they make sorting read naturally, and nowhere else.

The result

What itdoes now.

  • A polymorphic hierarchy that adds a new employee category without touching call sites.

  • Leak-free resource handling through RAII and ownership-expressing smart pointers.

  • Container choices driven by measured access patterns rather than default habit.

  • A versioned persistence format that validates on load instead of trusting the file.

Stack

Language

  • C++
  • STL
  • RAII

Design

  • Inheritance
  • Polymorphism
  • Encapsulation

Structures

  • Hash Maps
  • Vectors
  • Sorting Algorithms

Persistence

  • File I/O
  • Serialisation
Next project

CodePulse

A platform for running technical interviews online without the candidate being able to cheat, and without treating them like a suspect. Signal-based integrity monitoring paired with timed coding games that actually test how someone thinks.

Read case study