Files
lnet_tutor/learning_plans/cpp/00_CPP_MASTER_PLAN.md
2025-10-22 20:14:31 +08:00

18 KiB

C++ Advanced Learning - Master Plan

🎯 Goal: C++ Expert Mastery

This comprehensive plan will guide you from fundamentals to expert-level C++ development, covering everything from basic syntax to modern C++23 features, systems programming, and high-performance applications.

📊 Learning Journey Overview

Total Duration: 14-20 months (depending on pace) Target Level: Expert C++ Developer Daily Commitment: 2-4 hours recommended Prerequisites: Basic programming knowledge helpful but not required

🗺️ Learning Path Structure

Phase 1: C++ Foundations (2-3 months)
    └─> Syntax, Data Types, Control Flow, Functions
    
Phase 2: Object-Oriented C++ (3-4 months)
    └─> Classes, Inheritance, Polymorphism, Templates
    
Phase 3: Modern C++ (4-5 months)
    └─> C++11/14/17/20/23, Smart Pointers, Move Semantics, Lambda
    
Phase 4: Advanced C++ (4-5 months)
    └─> Memory Management, Concurrency, STL Mastery, Performance
    
Phase 5: Expert C++ (3-4 months)
    └─> Design Patterns, Best Practices, Systems Programming
    
Phase 6: Specialization (Ongoing)
    └─> Choose your domain (Game Dev, Systems, HPC, Embedded, etc.)

📚 Learning Modules Breakdown

Phase 1: C++ Foundations (Beginner)

Duration: 2-3 months | Difficulty: ☆☆☆

  1. Module 1.1: Getting Started (1 week)

    • Development Environment (VS Code, Visual Studio, CLion)
    • Compiler Setup (GCC, Clang, MSVC)
    • Build Tools (Make, CMake)
    • First Program (Hello World)
    • Compilation Process
    • Debugging Basics (gdb, lldb)
  2. Module 1.2: Basic Syntax & Types (2 weeks)

    • Variables & Constants
    • Fundamental Data Types (int, float, double, char, bool)
    • Type Modifiers (signed, unsigned, short, long)
    • Operators (Arithmetic, Relational, Logical, Bitwise)
    • Type Conversion & Casting
    • Auto Type Deduction
    • sizeof Operator
  3. Module 1.3: Control Flow (2 weeks)

    • if/else Statements
    • switch Statements
    • Ternary Operator
    • while & do-while Loops
    • for Loops
    • Range-based for (C++11)
    • break, continue, goto
    • Nested Control Structures
  4. Module 1.4: Functions (2 weeks)

    • Function Declaration & Definition
    • Parameters & Arguments
    • Return Types & Return by Value
    • Function Overloading
    • Default Arguments
    • Inline Functions
    • Recursion
    • Function Prototypes
  5. Module 1.5: Arrays & Strings (2 weeks)

    • C-style Arrays
    • Multi-dimensional Arrays
    • C-style Strings (char arrays)
    • std::string Class
    • String Operations
    • String Manipulation
    • C++17 string_view
  6. Module 1.6: Pointers & References (3 weeks)

    • Pointer Basics
    • Pointer Arithmetic
    • Pointers and Arrays
    • Pointer to Pointer
    • void Pointers
    • Function Pointers
    • References vs Pointers
    • const with Pointers/References
    • nullptr (C++11)

Phase 2: Object-Oriented C++ (Intermediate)

Duration: 3-4 months | Difficulty: ☆☆

  1. Module 2.1: Classes & Objects (3 weeks)

    • Class Definition
    • Access Specifiers (public, private, protected)
    • Member Functions
    • Constructors & Destructors
    • this Pointer
    • Static Members
    • Friend Functions & Classes
    • Nested Classes
  2. Module 2.2: Advanced Constructors (2 weeks)

    • Default Constructor
    • Parameterized Constructor
    • Copy Constructor
    • Move Constructor (C++11)
    • Constructor Delegation (C++11)
    • Converting Constructors
    • explicit Keyword
    • Initializer Lists
  3. Module 2.3: Operator Overloading (2 weeks)

    • Overloadable Operators
    • Member vs Non-member Overloading
    • Arithmetic Operators
    • Comparison Operators
    • Stream Operators (<<, >>)
    • Subscript Operator []
    • Assignment Operator
    • Increment/Decrement Operators
  4. Module 2.4: Inheritance (3 weeks)

    • Single Inheritance
    • Access Control in Inheritance
    • Multiple Inheritance
    • Virtual Inheritance
    • Constructor/Destructor in Inheritance
    • Protected Members
    • Order of Construction/Destruction
    • Inheritance Hierarchies
  5. Module 2.5: Polymorphism (3 weeks)

    • Compile-time vs Runtime Polymorphism
    • Virtual Functions
    • Pure Virtual Functions
    • Abstract Classes
    • Virtual Destructors
    • override & final (C++11)
    • Virtual Function Tables (vtable)
    • Dynamic Binding
  6. Module 2.6: Templates Basics (3 weeks)

    • Function Templates
    • Class Templates
    • Template Specialization
    • Non-type Template Parameters
    • Default Template Arguments
    • Template Template Parameters
    • typename vs class
    • Template Instantiation
  7. Module 2.7: Exception Handling (2 weeks)

    • try-catch Blocks
    • throw Statement
    • Standard Exception Classes
    • Custom Exceptions
    • Exception Specifications (deprecated)
    • noexcept (C++11)
    • RAII Pattern
    • Exception Safety Guarantees

Phase 3: Modern C++ (Advanced)

Duration: 4-5 months | Difficulty:

  1. Module 3.1: Memory Management (3 weeks)

    • Stack vs Heap
    • new & delete Operators
    • Memory Leaks
    • new[] & delete[]
    • Placement new
    • Memory Alignment
    • Custom Allocators
    • Memory Pool Pattern
  2. Module 3.2: Smart Pointers (3 weeks)

    • unique_ptr
    • shared_ptr
    • weak_ptr
    • make_unique & make_shared
    • Custom Deleters
    • Circular Reference Problem
    • Smart Pointer Casts
    • When to Use Which
  3. Module 3.3: Move Semantics (3 weeks)

    • lvalue vs rvalue
    • rvalue References (&&)
    • std::move
    • Perfect Forwarding
    • std::forward
    • Move Constructor
    • Move Assignment
    • Return Value Optimization (RVO)
  4. Module 3.4: Lambda Expressions (2 weeks)

    • Lambda Syntax
    • Capture Clauses ([=], [&], [this])
    • Generic Lambdas (C++14)
    • Init Capture (C++14)
    • Lambda as Function Arguments
    • Closure Types
    • mutable Lambdas
    • Recursive Lambdas
  5. Module 3.5: STL - Containers (4 weeks)

    • Sequence Containers (vector, deque, list, forward_list, array)
    • Associative Containers (set, map, multiset, multimap)
    • Unordered Containers (unordered_set, unordered_map)
    • Container Adaptors (stack, queue, priority_queue)
    • span (C++20)
    • Container Comparison & Selection
  6. Module 3.6: STL - Algorithms (3 weeks)

    • Non-modifying Algorithms (find, count, search)
    • Modifying Algorithms (copy, transform, replace)
    • Sorting Algorithms (sort, stable_sort, partial_sort)
    • Binary Search Algorithms
    • Heap Algorithms
    • Min/Max Algorithms
    • Numeric Algorithms
    • Ranges (C++20)
  7. Module 3.7: STL - Iterators (2 weeks)

    • Iterator Categories
    • Input/Output Iterators
    • Forward/Bidirectional Iterators
    • Random Access Iterators
    • Iterator Adaptors (reverse, insert, stream)
    • Iterator Traits
    • Custom Iterators
    • std::ranges (C++20)
  8. Module 3.8: Template Metaprogramming (3 weeks)

    • Template Specialization
    • Variadic Templates (C++11)
    • SFINAE
    • Type Traits
    • std::enable_if
    • if constexpr (C++17)
    • Concepts (C++20)
    • Compile-time Computation
  9. Module 3.9: C++11/14/17/20/23 Features (4 weeks)

    • C++11: auto, decltype, constexpr, nullptr
    • C++14: Generic lambdas, digit separators
    • C++17: Structured bindings, fold expressions, std::optional
    • C++20: Concepts, ranges, coroutines, modules
    • C++23: std::expected, deducing this, multidimensional subscript
    • Feature Adoption & Migration

Phase 4: Advanced C++ (Expert)

Duration: 4-5 months | Difficulty:

  1. Module 4.1: Concurrency (4 weeks)

    • std::thread
    • Mutexes & Locks
    • Condition Variables
    • std::atomic
    • Memory Ordering
    • std::future & std::promise
    • std::async
    • Thread-safe Data Structures
    • Lock-free Programming
  2. Module 4.2: Advanced Templates (3 weeks)

    • Template Argument Deduction
    • Template Aliases
    • CRTP (Curiously Recurring Template Pattern)
    • Policy-based Design
    • Tag Dispatching
    • Expression Templates
    • Template Concepts (C++20)
    • Constraints & Requires
  3. Module 4.3: Performance Optimization (4 weeks)

    • Profiling Tools (gprof, Valgrind, perf)
    • Cache Optimization
    • Branch Prediction
    • SIMD Programming
    • Compiler Optimizations
    • Link-time Optimization (LTO)
    • Profile-guided Optimization (PGO)
    • Inline Assembly
  4. Module 4.4: File I/O & Streams (2 weeks)

    • iostream Library
    • File Streams (ifstream, ofstream, fstream)
    • String Streams
    • Stream Manipulators
    • Stream States
    • Binary I/O
    • Memory-mapped Files
    • std::filesystem (C++17)
  5. Module 4.5: Build Systems (2 weeks)

    • CMake Advanced
    • Make & Makefiles
    • Package Managers (Conan, vcpkg)
    • Cross-platform Building
    • Static vs Dynamic Libraries
    • Precompiled Headers
    • Unity Builds
    • Build Optimization
  6. Module 4.6: Testing & Debugging (3 weeks)

    • Unit Testing (Google Test, Catch2)
    • Test-driven Development
    • Mocking (Google Mock)
    • Debugging Tools (gdb, lldb, Visual Studio debugger)
    • Address Sanitizer
    • Memory Sanitizer
    • Thread Sanitizer
    • Undefined Behavior Sanitizer
  7. Module 4.7: Design Patterns (4 weeks)

    • Creational Patterns (Singleton, Factory, Builder, Prototype)
    • Structural Patterns (Adapter, Bridge, Composite, Decorator)
    • Behavioral Patterns (Observer, Strategy, Template Method, Visitor)
    • Modern C++ Idioms
    • RAII Pattern
    • Pimpl Idiom
    • CRTP Applications
  8. Module 4.8: Const Correctness & Best Practices (2 weeks)

    • const Keyword Usage
    • const Member Functions
    • mutable Keyword
    • constexpr Functions (C++11)
    • consteval (C++20)
    • constinit (C++20)
    • Code Style Guidelines
    • Core Guidelines

Phase 5: Expert C++ (Master Level)

Duration: 3-4 months | Difficulty:

  1. Module 5.1: Advanced Memory (3 weeks)

    • Custom Memory Allocators
    • Memory Pools
    • Object Pools
    • Small Object Allocation
    • Garbage Collection Techniques
    • Memory Debugging
    • Memory Profiling
    • Cache-friendly Data Structures
  2. Module 5.2: Preprocessor & Macros (2 weeks)

    • Preprocessor Directives
    • Macro Functions
    • Conditional Compilation
    • Include Guards vs #pragma once
    • Variadic Macros
    • X-Macros Pattern
    • When to Avoid Macros
    • Modern Alternatives
  3. Module 5.3: Type System Deep Dive (3 weeks)

    • Type Categories
    • Type Deduction Rules
    • decltype & declval
    • std::decay
    • Reference Collapsing
    • Universal References
    • Type Erasure
    • Type Punning
  4. Module 5.4: Undefined Behavior (2 weeks)

    • Common UB Patterns
    • Integer Overflow
    • Out-of-bounds Access
    • Dereferencing Invalid Pointers
    • Data Races
    • Use-after-free
    • UB Sanitizers
    • Defensive Programming
  5. Module 5.5: ABI & Binary Compatibility (2 weeks)

    • Application Binary Interface
    • Name Mangling
    • extern "C"
    • ODR (One Definition Rule)
    • Symbol Visibility
    • Dynamic Loading
    • Plugin Architecture
    • Versioning Strategies
  6. Module 5.6: Embedded & Low-level (3 weeks)

    • Bit Manipulation
    • Hardware Interfacing
    • Memory-mapped I/O
    • Volatile Keyword
    • Inline Assembly
    • Bare-metal Programming
    • Real-time Constraints
    • Embedded Best Practices

Phase 6: Specializations (Choose Your Path)

Duration: Ongoing | Difficulty:

  1. Specialization A: Game Development

    • Game Engine Architecture
    • Entity Component Systems
    • Graphics Programming (OpenGL, Vulkan, DirectX)
    • Physics Engines
    • Audio Programming
    • Networking for Games
    • Game Optimization
    • Popular Engines (Unreal, Unity C++ scripting)
  2. Specialization B: Systems Programming

    • Operating System Concepts
    • System Calls
    • Process Management
    • Inter-process Communication
    • Memory Management
    • File Systems
    • Device Drivers
    • Kernel Programming
  3. Specialization C: High-Performance Computing

    • Parallel Algorithms
    • CUDA Programming
    • OpenMP
    • MPI (Message Passing Interface)
    • Vectorization
    • GPU Programming
    • Distributed Computing
    • Performance Analysis
  4. Specialization D: Financial Systems

    • Low-latency Trading Systems
    • Fixed-point Arithmetic
    • Concurrent Data Structures
    • Lock-free Programming
    • Cache Optimization
    • Network Programming
    • Real-time Requirements
    • Market Data Processing
  5. Specialization E: Embedded Systems

    • Microcontroller Programming
    • RTOS (Real-Time OS)
    • Hardware Abstraction Layers
    • Device Drivers
    • Protocol Implementations
    • Power Optimization
    • Safety-critical Systems
    • IoT Applications
  6. Specialization F: Graphics & Rendering

    • OpenGL/Vulkan/DirectX
    • Shader Programming (GLSL, HLSL)
    • Ray Tracing
    • 3D Math
    • Texture Mapping
    • Scene Graphs
    • Animation Systems
    • GUI Frameworks (Qt, wxWidgets)

📈 Progress Tracking

Mastery Levels

  • Level 0: Unfamiliar - Never encountered
  • Level 1: Aware - Basic understanding, need heavy documentation
  • Level 2: Competent - Can use with documentation
  • Level 3: Proficient - Use confidently without documentation
  • Level 4: Expert - Can teach, optimize, solve complex problems

Weekly Goals

  • Complete 1-2 modules per month
  • Code daily (1-2 hours minimum)
  • Build 1 small project per week
  • Read C++ source code (STL, Boost)
  • Contribute to open source monthly

Monthly Assessments

  • Take comprehensive exam covering month's topics
  • Build one medium project
  • Code review own and others' code
  • Write blog post or documentation

🎓 Learning Resources

Books (Essential Reading)

  1. "C++ Primer" by Stanley Lippman - Comprehensive introduction
  2. "Effective C++" by Scott Meyers - Best practices (series of 3 books)
  3. "The C++ Programming Language" by Bjarne Stroustrup - By creator
  4. "C++ Concurrency in Action" by Anthony Williams - Threading
  5. "Modern C++ Design" by Andrei Alexandrescu - Advanced templates
  6. "Exceptional C++" by Herb Sutter - Problem solving
  7. "C++17 STL Cookbook" by Jacek Galowicz - Modern STL

Online Resources

  • cppreference.com - Best C++ reference
  • isocpp.org - ISO C++ website
  • CppCon talks (YouTube)
  • Meeting C++ conference videos
  • Compiler Explorer (godbolt.org)
  • Quick Bench (quick-bench.com)

Practice Platforms

  • LeetCode - Algorithms
  • HackerRank - C++ challenges
  • Codewars - C++ kata
  • Project Euler - Mathematical problems
  • Exercism - Mentored practice

🏆 Milestones & Achievements

Milestone 1: C++ Basics Complete (Month 2-3)

  • Understand syntax, pointers, references
  • Write basic programs with functions
  • Manage memory manually
  • Use arrays and strings
  • 🎯 Project: CLI utility (file processor, calculator)

Milestone 2: OOP Mastery (Month 5-7)

  • Master classes, inheritance, polymorphism
  • Use templates effectively
  • Handle exceptions properly
  • Overload operators
  • 🎯 Project: Container class library

Milestone 3: Modern C++ (Month 9-12)

  • Use smart pointers exclusively
  • Apply move semantics
  • Master STL containers/algorithms
  • Write template metaprograms
  • 🎯 Project: Custom data structure library

Milestone 4: Advanced C++ (Month 13-17)

  • Write thread-safe concurrent code
  • Optimize performance
  • Master build systems
  • Write comprehensive tests
  • 🎯 Project: Multi-threaded application

Milestone 5: Expert Level (Month 18-20)

  • Understand C++ internals
  • Write production-quality code
  • Master chosen specialization
  • Contribute to major projects
  • 🎯 Project: Complete application in specialization

📝 Assessment Strategy

Weekly Quizzes

  • 10-15 questions on week's topics
  • Mix of theory and code analysis
  • "I don't know" option for honesty

Monthly Comprehensive Exams

  • 30-50 questions
  • Code writing exercises
  • Debugging challenges
  • Performance analysis

Project Assessments

  • Code quality review
  • Memory leak detection
  • Performance profiling
  • Best practices adherence

Continuous

  • Track study time
  • Monitor quiz/exam scores
  • Identify weak areas
  • Adjust pace as needed

🚀 Getting Started

Week 1 Action Plan

  1. Install compiler (GCC/Clang/MSVC)
  2. Set up IDE (VS Code/Visual Studio/CLion)
  3. Write and compile first program
  4. Learn basic debugging
  5. Take first quiz on basics

Daily Study Routine

  • Morning (30 min): Read theory/documentation
  • Afternoon (90 min): Hands-on coding practice
  • Evening (30 min): Review, quiz, or project work

Weekend Activities

  • Build projects
  • Read C++ source code (STL, Boost)
  • Watch CppCon talks
  • Contribute to open source

💡 Learning Tips

  1. Master Pointers Early: They're fundamental to C++
  2. Use Compiler Warnings: Enable -Wall -Wextra
  3. Read STL Source: Best way to learn advanced techniques
  4. Profile, Don't Guess: Use profiling tools
  5. Understand Memory: Crucial for C++ mastery
  6. Modern > Legacy: Focus on C++11 and later
  7. Practice Daily: Consistency is key
  8. Join Community: r/cpp, C++ Slack, Discord

🔗 Next Steps

  1. Review detailed modules in 01_KNOWLEDGE_GRAPH.md
  2. Assess your level in 02_INITIAL_ASSESSMENT.md
  3. Follow weekly schedule in 03_WEEKLY_SCHEDULE.md (coming soon)
  4. Track progress in 04_PROGRESS_TRACKER.md (coming soon)
  5. Start with Module 1.1

Remember: C++ is complex and powerful. Take your time to deeply understand each concept. The learning curve is steep, but the rewards are immense! 💪🚀