Project organization tasks — 8 structured refactors

← Module home · Each task: a starting shape, a target shape, and a verification gate. Do them on real programs you already wrote — the arrays, strings, records, and OOP labs are the raw material.

The tasks form a ladder — each assumes the previous. The verification gate after every task is identical: the program’s output is unchanged, the build is warning-free (-Wall -Wextra), and each module compiles alone.



Notes on the ladder

A worked fragment (T1, the toolkit split)

Before — one file, prototypes on top, main below (the Unit 07 shape). After:

toolkit.h:      #pragma once  ·  namespace toolkit  ·  the three prototypes
toolkit.cpp:    #include "toolkit.h"   (FIRST)  ·  the three bodies
main.cpp:       #include "toolkit.h"   ·  main() unchanged

The gate’s third clause — g++ -std=c++17 -Wall -Wextra -c toolkit.cpp succeeding alone — is the step beginners skip and professionals never do: it proves the module’s self-containment before the program depends on it.

— Engr. Dr. Muhammad Nadeem Majeed, Professor, Department of Data Science (PUCIT), University of the Punjab, Lahore · About the instructor