PCPP2 study materials
PCPP2 study resources

PCPP2 study plan

PCPP2 · Give each week a clear focus.

8 weeks · About 6 hours per week

Week 1

Testing principles and techniques (unittest and pytest frameworks)

  • Write unittest test cases with setUp, tearDown, and assertRaises for a small module and run them with python -m unittest

  • Convert the same test suite to pytest using plain assert statements, fixtures, and parametrize

  • Measure coverage with coverage.py and identify at least three uncovered branches in your own code

  • Explain the difference between a mock, a stub, and a spy and apply unittest.mock.patch to isolate an external call

Your checkpoint

A public-style repo containing one module tested twice (unittest and pytest), a coverage report showing at least 85% line coverage, and a short README comparing the two frameworks

Week 2

Testing principles and techniques (unittest and pytest frameworks) & Design patterns (OOP design principles; Singleton, Factory, Facade, Proxy, Observer, Command, Template Method, and State)

  • Apply test-driven development to build a small class by writing failing tests first, then minimal code, then refactor

  • Write tests for exceptions, edge cases, and slow operations using pytest.raises, pytest.mark.skip, and pytest.mark.parametrize

  • Implement the Singleton pattern in three ways (module-level instance, new, metaclass) and write tests proving only one instance exists

  • Implement the Factory pattern and test that the factory returns the correct concrete class for each input key

Your checkpoint

A TDD-built mini library with a full pytest suite and two design patterns (Singleton and Factory) each backed by passing tests

Week 3

Design patterns (OOP design principles; Singleton, Factory, Facade, Proxy, Observer, Command, Template Method, and State)

  • Implement the Facade pattern to wrap a multi-step subsystem behind a single simplified interface and test it with mocks

  • Implement the Proxy pattern for lazy loading and access control, and test both the allowed and denied paths

  • Implement the Observer pattern with a subject that notifies registered callbacks and test notification order and unsubscribe behavior

  • Compare the Command and Template Method patterns by coding one example of each and documenting when each is preferable

Your checkpoint

A patterns package containing Facade, Proxy, Observer, Command, and Template Method implementations, each with at least three unit tests and a one-paragraph design rationale

Week 4

Design patterns (OOP design principles; Singleton, Factory, Facade, Proxy, Observer, Command, Template Method, and State) & Interprocess communication (multiprocessing, threading, subprocess management, multiprocess synchronization)

  • Implement the State pattern as a state machine with explicit transitions and test every legal transition plus one illegal one

  • Create a thread with threading.Thread, run work in it, and join it correctly without blocking the main thread prematurely

  • Protect shared state with threading.Lock and demonstrate a race condition before the lock and its absence after

  • Use concurrent.futures.ThreadPoolExecutor and ProcessPoolExecutor and explain when each is appropriate for CPU-bound versus IO-bound work

Your checkpoint

A state-machine module plus a concurrency demo script that reproduces a race condition, fixes it with a lock, and prints deterministic results across ten runs

Week 5

Interprocess communication (multiprocessing, threading, subprocess management, multiprocess synchronization)

  • Start processes with multiprocessing.Process and exchange data through Queue and Pipe

  • Share state safely with multiprocessing.Value, Array, and Lock, and explain why plain globals fail across processes

  • Use multiprocessing.Pool.map and apply_async to parallelize a CPU-bound task and compare timing to a serial run

  • Launch external commands with subprocess.run, capture stdout and stderr, check return codes, and handle timeouts

  • Explain and demonstrate the difference between subprocess.Popen, run, and check_output, including shell=True risks

Your checkpoint

A parallel data-processing script using multiprocessing.Pool with synchronization, plus a subprocess wrapper that runs an external command, validates its exit status, and raises on failure, both with tests

Week 6

Interprocess communication (multiprocessing, threading, subprocess management, multiprocess synchronization) & Network programming (socket module and socket programming, automating complex network configurations, software-defined networking, network security)

  • Build a TCP echo server and client with the socket module and handle multiple clients using threads

  • Explain the difference between blocking and non-blocking sockets and demonstrate selectors for multiplexing

  • Create a UDP sender and receiver and contrast connectionless behavior with TCP

  • Use socket timeouts and handle ConnectionResetError and socket.timeout gracefully

Your checkpoint

A threaded TCP chat server with a client script, a UDP demo, and a test suite that starts the server on an ephemeral port and verifies message delivery

Week 7

Network programming (socket module and socket programming, automating complex network configurations, software-defined networking, network security)

  • Parse and construct IPv4 and IPv6 addresses with the ipaddress module and validate network membership

  • Explain how software-defined networking separates the control plane from the data plane and describe the role of a controller and OpenFlow-style flow rules

  • Apply TLS to a socket connection with ssl.SSLContext and verify certificates

  • Identify common network security weaknesses (unvalidated input, plaintext credentials, missing timeouts) and harden the week 6 server against them

Your checkpoint

A hardened TLS-enabled server with input validation and a written threat note listing at least five risks and the mitigation applied to each

Week 8

Python-SQL and Python-NoSQL database access (relational and non-relational databases, CRUD, ORM)

  • Perform CRUD operations against SQLite with the sqlite3 module using parameterized queries and transactions

  • Model a schema with an ORM such as SQLAlchemy, define relationships, and query with filters and joins

  • Perform CRUD against a NoSQL store such as MongoDB or a document-style store and compare its data model to a relational one

  • Write tests that use an in-memory database fixture so the suite runs without external services

  • Review weak areas across all five domains and re-run every earlier deliverable's tests

Your checkpoint

A database access layer with SQL and ORM implementations plus a NoSQL variant, all covered by tests using in-memory or temporary fixtures, and a personal gap list of weak topics with a remediation plan

Milestones

Week 2: You can write a pytest suite from scratch for unfamiliar code and explain fixture scoping and parametrization without notes

Week 4: You can name all eight required patterns, state the problem each solves, and show a working tested implementation of at least four of them

Week 5: You can explain why a shared global counter fails across processes and demonstrate a lock-protected fix under multiprocessing

Week 6: You can write a working threaded TCP server and client from memory and justify TCP versus UDP for a given use case

Week 7: You can describe control-plane versus data-plane separation in SDN and list five concrete network security mitigations you implemented

Week 8: You can complete a CRUD task in both SQL and an ORM, and explain when a document store is preferable to a relational one