Skip to main content

Lesson 5 of 7

Extending the System - Ideas & Next Steps

The IMS is a solid foundation. Here are the most impactful extensions to explore as you grow beyond this course, each mapping to real professional C++ skills.

10 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Extension Ideas - Mapped to Professional C++ Skills

Extension Ideas - Mapped to Professional C++ Skills
// ══════════════════════════════════════════════════════════════
//  Extension Ideas for the Inventory Management System
// ══════════════════════════════════════════════════════════════

// ── 1. Unit Testing with GoogleTest ──────────────────────────
// Install: CMake FetchContent or vcpkg
// Test ideas:
//   - ProductTest: construction, validation, move, copy-delete
//   - InventoryTest: add/remove/find, duplicate id rejection
//   - FileStoreTest: round-trip save/load, corruption recovery
//   - ReportTest: filter/sort/aggregate correctness

// Example test:
/*
#include <gtest/gtest.h>
TEST(ProductTest, PriceValidation) {
    EXPECT_THROW(Product("bad", "cat", -1.0, 10), std::invalid_argument);
}
TEST(InventoryTest, AddAndFindById) {
    Inventory<Product> inv;
    auto p = std::make_unique<Product>("Widget", "misc", 9.99, 5);
    int  id = p->id();
    inv.add(std::move(p));
    EXPECT_EQ(inv.find(id).name(), "Widget");
    EXPECT_THROW(inv.find(999), ProductNotFound);
}
*/

// ── 2. JSON/CSV Serialisation with a real library ─────────────
// - Use nlohmann/json (header-only) for proper JSON I/O
// - Add Product::to_json() / from_json(nlohmann::json) overloads
// - Persist as JSON array - human-readable, diff-friendly

// ── 3. Concurrency - Transaction Queue ────────────────────────
// - std::thread worker that processes transactions from a queue
// - std::mutex + std::condition_variable for producer/consumer
// - Adds std::thread, std::atomic, lock-free queue experience

// ── 4. std::ranges pipeline (C++20) ──────────────────────────
//   auto expensive_phys =
//       inventory
//       | std::views::filter([](const Product& p){ return p.category()=="Physical"; })
//       | std::views::filter([](const Product& p){ return p.price() > 100.0; })
//       | std::views::transform([](const Product& p){ return p.name(); });
//   for (const auto& name : expensive_phys) std::cout << name << "
";

// ── 5. User Roles with strategy pattern ───────────────────────
// class Permission { virtual bool can_delete() const = 0; ... };
// class AdminPermission : public Permission { ... };
// class ReadOnlyPermission : public Permission { ... };
// Demonstrates virtual dispatch + interface design beyond product hierarchy

// ── 6. Price history as std::deque with timestamps ───────────
// struct PriceEntry { double price; std::chrono::system_clock::time_point when; };
// std::deque<PriceEntry> price_history;  // efficient push_front, bounded size
// Demonstrates: deque, chrono, and sliding window data structures

// ── 7. Event system with std::function callbacks ─────────────
// class EventBus {
//   std::unordered_map<std::string, std::vector<std::function<void(const Event&)>>> handlers_;
//   void on(std::string event, std::function<void(const Event&)> handler);
//   void emit(std::string event, const Event& data);
// };
// Demonstrates: std::function, type erasure, event-driven architecture

// ── 8. CLI colour output with ANSI codes ─────────────────────
// const char* RED   = "";
// const char* GREEN = "";
// const char* RESET = "";
// std::cout << (p.quantity() < 5 ? RED : GREEN) << p.quantity() << RESET;

// ── Professional C++ next steps beyond this course ───────────
// - CMake: interdependent targets, find_package, vcpkg integration
// - Sanitizers: ASan + UBSan in CI
// - clang-format + clang-tidy: enforce code style and catch issues
// - Benchmarking: Google Benchmark for performance measurement
// - Profiling: perf (Linux), Instruments (macOS), VTune (Windows)
// - Coroutines (C++20): co_await, co_yield for async yields
// - Modules (C++20): import std; - faster compilation
// - Concepts (C++20): requires clauses for cleaner template errors

std::cout << "Congratulations - you have completed the C++ curriculum!\n"
          << "You now know:\n"
          << "  * The full C++ type system and how it works at runtime\n"
          << "  * OOP with proper encapsulation, polymorphism, and design patterns\n"
          << "  * Memory management and RAII with smart pointers\n"
          << "  * Template metaprogramming and generic containers\n"
          << "  * The complete STL with performance-aware container choice\n"
          << "  * Modern C++11-17: move semantics, lambdas, optional, variant\n"
          << "  * Exception safety and production error handling\n"
          << "  * File I/O and std::filesystem\n"
          << "  * The Rule of 5 and language-level class design\n";
Diagram
Loading diagram…

Scaling the System: SQLite Integration, REST APIs, JSON Serializers & Thread-Pool Caching

Next Steps for Professional Growth

  • **Code review** - find a C++ open-source project (LLVM, folly, range-v3, abseil) and read their code. Notice how they apply the patterns you've learned at scale. Try submitting a small documentation fix or test.
  • **Build something** - pick one of the extensions and implement it properly. Writing real code that interests you (game engine math library, HTTP parser, simulation) is the fastest way to make these concepts permanent.
  • **C++ Core Guidelines** - read Bjarne Stroustrup and Herb Sutter's C++ Core Guidelines (online). They codify the best practices you've learned here with detailed rationale. Use the clang-tidy checks that enforce them automatically.

Key Takeaways

  • The IMS is a solid foundation.
  • *Code review** - find a C++ open-source project (LLVM, folly, range-v3, abseil) and read their code. Notice how they apply the patterns you've learned at scale. Try submitting a small documentation fix or test.
  • *Build something** - pick one of the extensions and implement it properly. Writing real code that interests you (game engine math library, HTTP parser, simulation) is the fastest way to make these concepts permanent.
  • *C++ Core Guidelines** - read Bjarne Stroustrup and Herb Sutter's C++ Core Guidelines (online). They codify the best practices you've learned here with detailed rationale. Use the clang-tidy checks that enforce them automatically.

Topics in This Module

0/7 done