- 45lessons
- 3guided projects
- 8module checkpoints
- 1.9hours of video
What you'll learn
- Name, document and structure code so a new reader understands intent without help.
- Draw function boundaries and flatten conditionals using catalogue refactorings.
- Remove duplication and weak data representation without merging coincidentally similar code.
- Judge cohesion and coupling and apply design principles as questions rather than dogma.
- Design explicit, honest error contracts with narrow handlers and reliable cleanup.
Skills you'll gain
- Readability
- naming
- Function boundaries
- Data
- duplication
- Dependencies
- cohesion
- Error contracts
- Refactoring techniques
- Behavior-preserving tests
- Refactoring review
Tools you'll use
- Python
- unittest
- radon (optional)
Details to know
- Certificate on completionIssued after your final project is reviewed
- 8 module checkpointsA quiz and a practical task close each module
- Self-pacedStudy any time; your progress is saved
How every lesson works
Each lesson follows the same four steps, so you always know what comes next.
- 01
Watch & Learn
A short animated video explains one idea at a time.
- 02
Guided Practice
Work through an example step by step and check the result.
- 03
Quiz & Challenge
Short questions check the idea has landed before you move on.
- 04
Mini Project
Build something useful from a project brief.
Learn at your own pace
This is a self-paced course. There are no live classes and no fixed timetable.
- Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
- Pick up where you left offYour progress is saved to your account.
- Ask when you're stuckUse Ask Mentor inside the learning platform.
Your path in 4 phases
Each phase ends with something you have built and checked.
- 01
Modules 1 to 2
Readable clinic billing module
Covers Readability and naming and Function boundaries.
You build: Guided project: Renamed identifiers, PEP 8 names with aliases and named constants, tests unchanged Honest comments, docstrings and two extracted functions.
- 02
Modules 3 to 5
Decoupled warehouse and club manager
Covers Data and duplication, Dependencies and cohesion and Error contracts.
You build: Guided project: Duplication decision log and data refactorings with green tests Extracted class, moved function, injected collaborators and a design decision record.
- 03
Modules 6 to 7
Safety net for the legacy scheduler
Covers Refactoring techniques and Behavior-preserving tests.
You build: Guided project: Step log of five small refactorings, smell triage and leave-alone memo; Characterization, golden master, seam, differential harness and two-commit split.
- 04
Module 8
Final project and assessment
Covers Refactoring review, then the final project: Refactored application with unchanged verified behavior.
You build: Final project, one of: Option A: refactor a supplied 600-line inventory and ordering application written without tests.
Full curriculum
8 modules and 45 lessons, 27 to 46 hours of study
01Readability and naming5 lessons, 2 to 4 hours
Lessons
- Names that reveal intent
- Naming conventions and consistency
- Magic literals and named constants
- Comments: explain why, not what
- Docstrings as contracts
After this module you can
- Rename three vague identifiers in a 20-line function to intent-revealing names and show the supplied tests pass before and after.
- Apply PEP 8 naming (snake_case functions, CapWords classes, UPPER_CASE constants, leading underscore for non-public) to a mixed-style module without changing behaviour.
- Write docstrings that state summary, parameters, return value, side effects and raised exceptions for three functions, checked by ast.get_docstring.
02Function boundaries5 lessons, 2 to 4 hours
Lessons
- Extract Function from a commented block
- One level of abstraction and Decompose Conditional
- Guard clauses instead of nested conditionals
- Parameter lists: parameter objects and flag arguments
- Separate Query from Modifier
After this module you can
- Extract a commented block of a 40-line function into a named function, pass in only what it needs, and show the tests are green before and after.
- Rewrite a function whose body mixes high-level steps and low-level detail so each function stays at one level, and name complex conditions with Decompose Conditional.
- Split a function that both returns a value and changes state into a pure query and a command, update the callers, and show repeated query calls leave state unchanged.
03Data and duplication6 lessons, 3 to 4 hours
Lessons
- Spotting duplication and Parameterize Function
- Duplication that is not duplication
- Replace Primitive with Object
- Replace Temp with Query and Split Variable
- Encapsulate Collection and aliasing
- Replace Loop with Pipeline and Split Loop
After this module you can
- Find two near-duplicate functions, merge them with Parameterize Function, and show both original behaviours are reproduced by the merged one.
- Decide for four code pairs whether to merge, keep apart or wait, using the rule of three and the reason each pair changes.
- Convert a loop that accumulates two unrelated results into two comprehensions or generator expressions and compare outputs to the loop on supplied data.
04Dependencies and cohesion6 lessons, 3 to 4 hours
Lessons
- Cohesion and Extract Class
- Coupling, feature envy and Move Function
- Message chains, Hide Delegate and Remove Middle Man
- Injecting collaborators to cut hard dependencies
- Design principles without dogma: SOLID as questions
- Replace Conditional with Polymorphism and its alternatives
After this module you can
- Measure which methods use which fields in a class, identify two clusters, and split the class with Extract Class while the supplied tests pass.
- Detect a method that uses another class's data more than its own and move it with Move Function, keeping tests green.
- Replace a type-code if/elif chain with polymorphism or a dispatch table, comparing which is simpler for the case, with tests unchanged.
05Error contracts5 lessons, 2 to 4 hours
Lessons
- Replace Error Code with Exception
- Catching narrowly, re-raising and chaining
- Preconditions, assertions and Replace Exception with Precheck
- Special Case objects instead of None
- Cleanup and messages: with, finally and error text
After this module you can
- Replace sentinel return values like -1 or None with a specific exception, update every caller, and keep the documented happy path tests green.
- Rewrite an over-broad except block to catch only expected exceptions, use bare raise to propagate and raise ... from to translate, and show unexpected errors still surface.
- Make a function release a resource on every path using with or finally and rewrite error messages so a reader can act on them.
06Refactoring techniques6 lessons, 3 to 4 hours
Lessons
- The refactoring loop: small steps on green
- Smells as hints: triage by cause and cost
- Safe rename, move and Change Function Declaration
- Split Phase: separating parsing from computing
- Inline Function, Remove Dead Code and Substitute Algorithm
- When not to refactor: judgement and design simplicity
After this module you can
- Perform a four-step refactoring as separate commit-sized changes, running the tests after each and reverting the one step that turns red.
- Identify at least six smells (long function, large class, data clump, shotgun surgery, feature envy, duplicated code) in a sample and rank which to address first with a reason.
- Decide for five scenarios whether to refactor now, later or never, using tests present, change frequency, deadline pressure and the simple-design rules.
07Behavior-preserving tests6 lessons, 3 to 4 hours
Lessons
- Characterization tests for untested code
- Golden master and approval tests for large output
- Creating seams: making code testable without changing behaviour
- Differential testing: old against new during a refactor
- Separate structure changes from behaviour changes
- Tests that survive refactoring: coupling to behaviour, not structure
After this module you can
- Write characterization tests that record what a legacy function actually does for chosen inputs, including surprising results, before touching it.
- Capture a large report output as a stored golden file, compare after refactoring with a diff and normalise non-deterministic parts.
- Revise tests that break on every internal rename so they assert observable behaviour, and judge when a test should be deleted.
08Refactoring review6 lessons, 3 to 4 hours
Lessons
- Reading complexity metrics and their limits
- Diff-size and structure assertions as evidence
- Reviewing a refactoring diff
- Documenting refactoring decisions
- Prioritising a refactoring plan: hotspots, cost and sequencing
- Whole-application refactoring review and release gate
After this module you can
- Compute cyclomatic complexity by hand for three functions with radon's counting rules, compare with a script, and explain two ways the number misleads.
- Write a script that asserts a refactoring diff stays within size limits and meets structural targets, and run it against a before and after pair.
- Run a complete refactoring review of a small application: unchanged characterization suite, structure assertions, diff-size limits, metric table, review checklist and a go or no-go decision.
What you'll build
3 guided projects along the way, then a final project.
Readable clinic billing module
after module 2Decoupled warehouse and club manager
after module 5Safety net for the legacy scheduler
after module 7
Final project
Refactored application with unchanged verified behavior. Options: Option A: refactor a supplied 600-line inventory and ordering application written without tests.
What you submit
Source submission of the refactored application and the characterization tests, in version control with a commit series. Functional checks: the learner's characterization suite passes before and after.
How it's reviewed
Trainer-reviewed demonstration, scored on: Behaviour preserved on hidden inputs (30%) Quality and size of steps and commits (20%) Structural improvement measured with assertions and metrics, with caveats stated (20%) Honest error contracts and docs (15%).
Where you'll use it
- Put characterization tests around a legacy module before changing it.
- Split a long function into named steps and show in review that behaviour did not change.
Roles that use these skills
- Software Developer
- Backend Developer
- Software Engineer
Earn the certificate by building, not watching
- Complete the lessons and pass each module checkpoint.
- Build your final project and demonstrate it.
- OUTLEARN reviews your project and issues your certificate. It is not issued automatically.
Frequently asked questions
What do I need before starting?
Completion of Software Testing and TDD or equivalent: you can write unittest tests, read failures and run a suite. You also need to read and write basic Python (functions, classes, exceptions, comprehensions).
When do I get a certificate?
We do not issue certificates until you successfully build and demonstrate your live project. Staff issue certificates after review; nothing is issued automatically.
Be first in when Clean Code & Refactoring opens
Email us and we will tell you as soon as enrolment opens.
Notify me when it opens
