# Refactoring Legacy Code

## About

- Level: Intermediate to Advanced
- Lectures: 20 hours
- Self-study: 10 hours
- Exercises: 22
- Lines of code to write: 118
- Format: e-learning + weekly online meeting with the instructor
- Language: English or Polish

## Description

Practice improving existing Python code in small, reviewable steps. Begin by understanding behavior and adding useful tests, then reduce duplication, separate responsibilities, and modernize selected components. A practical project brings analysis, documentation, and refactoring together.

## Advantages

Learn to make changes with evidence that the required behavior is preserved. The techniques help you approach unfamiliar code, plan manageable updates, and leave clearer explanations for the next person maintaining it.

## Target Audience

- Python developers maintaining older or unfamiliar codebases.
- Engineers preparing dependency or language-version upgrades.
- Teams introducing tests and clearer structure into an existing project.

## Format

Learn through short videos and worked examples, then apply each topic in coding exercises. Automated checks help you test your solutions, and a progress spreadsheet helps you see what to work on next.

Weekly online meetings give you time for questions, code reviews, and working through difficult exercises with the instructor. Downloadable code, exercise templates, and reference notes support your independent practice.

Our trainers prepare the teaching materials from their professional experience. The materials have been developed since 2015, with more than 28,000 automated tests checking the code examples. Training is available in English or Polish.

## Course Outline

1. Introduction to Working with Legacy Code:

   - Definition and characteristics of legacy code
   - Common challenges and issues
   - Strategies for working with legacy code
2. Code Analysis and Documentation:

   - Tools for static and dynamic analysis
   - Creating diagrams and visualizing code
   - Documenting existing code
3. Code Refactoring:

   - Identifying problematic areas
   - Refactoring techniques: extracting functions, reducing complexity, eliminating duplication
   - Introducing design patterns into legacy code
4. Testing Legacy Code:

   - Introducing tests to untested code
   - Creating unit and integration tests
   - Tools for test coverage
5. Code Modernization:

   - Updating dependencies and libraries
   - Migrating to newer Python versions
   - Using modern Python language features
6. Tools Supporting Work with Legacy Code:

   - Linters and static analyzers
   - Tools for visualizing code architecture
   - Version control systems and their use in working with legacy code
   - CI/CD systems and automation of test execution
   - Code review process
7. Practical Project:

   - Analysis, refactoring, and modernization of a legacy code segment
   - Introducing tests and documentation
   - Retrospective and discussion of results

## Our Experience

AATC trainers have taught software engineering since 2015, delivering more than 11,000 hours of training to over 32,000 students worldwide. The exercises draw on that teaching experience and professional projects.

## Prerequisites

- Intermediate knowledge of Python programming
- Familiarity with using an IDE (e.g., PyCharm, VSCode)
- Familiarity with using version control systems (e.g., Git)
- Understanding of AI-assisted coding tools (e.g., GitHub Copilot, ChatGPT)

## Setup

- Newest version of Python
- IDE of your choice (e.g., PyCharm, VSCode)
- Git installed and configured
- GitHub account
- Web browser (e.g., Chrome, Firefox, Safari, etc.)

## Related Courses

- [Python Basics](<https://aatc.pl/software/python/basics/index.md>)
- [Python Intermediate](<https://aatc.pl/software/python/intermediate/index.md>)
- [Python Advanced](<https://aatc.pl/software/python/advanced/index.md>)
- [Design Patterns](<https://aatc.pl/software/engineering/design-patterns/index.md>)
- [Profiling](<https://aatc.pl/software/engineering/profiling/index.md>)
- [Refactoring](<https://aatc.pl/software/engineering/refactoring/index.md>)
- [Testing](<https://aatc.pl/software/engineering/testing/index.md>)
- [DevOps](<https://aatc.pl/software/engineering/devops/index.md>)
- [Regular Expressions](<https://aatc.pl/software/engineering/regex/index.md>)
- [All Courses](<https://aatc.pl/software/index.md>)

## Date

This course is scheduled on demand. Contact us with your preferred dates and group size so we can check availability and arrange a suitable session.

## Contact

Email [info@aatc.pl](<mailto:info@aatc.pl>) for help with program details, preparation, or booking.

## Apply

To apply, email [info@aatc.pl](<mailto:info@aatc.pl>) with your name, the program you are interested in, and your preferred dates.
