Python 010: Python Legacy Code
Techniques and Best Practices for Working with Python Legacy Code

You need to understand a complex Python code base without a test suite and implement further requirements based on it? You don't dare to change the existing code because of side-effects that might affect other modules and cause errors in other places? In other words, you have to work with Python legacy code and you want to learn the best strategies and techniques to build a safety net first, so that you can understand the existing code step by step and refactor it into clean code? Then this is the course for you! Having to understand and work with an old complex code base without a test suite is by far the most unpleasant thing software developers have to deal with on a daily basis. But not if you know the techniques for working with legacy code. With the appropriate know-how and practical best practices, this challenging task becomes one of the most interesting tasks. Learn more about this exciting training on working with Python legacy code...


  • Learn best practices for working with Python legacy code
  • Understand existing complex Python code base effectively
  • Create safety nets for legacy code in the form of test suites
  • Gradually transform legacy code into higher quality clean code
  • Safely evolve and adapt existing legacy projects
  • Create test suites instead of a completely new development or a big redesign
  • Significantly reduce training and development time when legacy code becomes clean code

This Working with Python Legacy Code course is one of the most popular at the Munich Coding Academy. This is because almost every company has to deal with legacy code. The benefits of this course are very high, because the techniques learned can be immediately integrated into everyday work and applied directly, so that software developers become faster and more confident when they have to work with legacy code.

Course formats



Live oder online large

Teaching material



Video clips


Live oder online large

Teaching material



Snacks large


Online large

Teaching material



Video clips

All courses also include unlimited access to our member area with many more videos, tutorials and information about coding.


The course covers a selection of the following topics:

  • Introduction to Python Unit Testing
  • Introduction to Clean Code
  • Introduction to Refactoring Patterns
  • Golden Master
  • Seams
  • Test Coverage
  • Mutation Testing
  • Adding a Feature
  • Get a Class into a Test Harness
  • Run a Method in a Test Harness
  • Breaking Monster Class
  • Changing Monster Method
  • Dependency Breaking Techniques

For more details, please see the agenda below.


This Working with Python Legacy Code course has been designed for software developers and programmers with solid and good Python knowledge, comparable to our Python for beginners course.

It would be advantageous if you are already familiar with unit testing and clean code to the extent of our unit testing and clean code courses. However, this is not a prerequisite as we will also give a small introduction to these topics at the beginning of the course.

  • Individual: we specifically address your needs and take into account your previous knowledge, desired topics and focal points

  • Structured and easy to understand

  • Take your career, studies or training to the next level: with certificate

  • Safely and independently develop programmes (whether private, professional or for your start-up)

  • Lots and lots of practice: immediately applicable results

  • Small groups: max. 8 participants in the 3-day course max. 12 participants in online coaching

  • Developed by experts according to the Raed Method® & geared to the requirements of tech companies in 2020

  • E-mail support even after the end of the course


The Working with Legacy Code seminar at Coding Akademie München is ideal for developers with basic Python knowledge who are working with legacy code in an ongoing project. Or for anyone who is maintaining an existing project without a test suite or unit test. During the three-day seminar, we will shed light on legacy code, which is generally more difficult to test. After all, the reasons for this are usually hidden. Either there is no unit test for this code. Or the existing unit test is not sufficient. Or it does not cover all relevant cases. This makes one or the other programmer think about reprogramming the whole project. But this is only necessary in very few cases. Because often the projects are very large, complex and the resulting software is already marketed. This makes it impossible to set up the code completely new and clean.

This is exactly where our Legacy Code Seminar comes in. During the three days you write step by step specific tests for the corresponding modules. This secures you and your project and lets you change and adapt the code in peace and bring it into a much better state with Clean Code rules. Your software gets better from day to day. Your code quality increases. Changes and adaptations become easier. And you keep the original code, which guarantees smooth and safe operation of the application.

Of course, you write the Python test and codes under the guidance of proven subject matter experts and renowned Python trainers who lecture at the best universities in the country. This safeguards you and lets you playfully understand the tricks of legacy code. The pleasant environment in our modern training center is also partly responsible for this good feeling. Whether online or offline. It is located in the center of Munich and is easily accessible by car or public transport. Once you are there, you can look forward to state-of-the-art computers - as well as delicious snacks and drinks waiting for you during your Legacy Code seminar.

What do you learn on the first day?

On the first day we need to establish that you have the necessary foundation for this course. Therefore, we will do a quick introduction to Unit Testing as well as the most important Clean Code rules. Of course it would be great if you have a good knowledge in this area as in our Unit Testing and Clean Code courses. But this is not a must. Hence the introductions to these topics. Then we start with the techniques you can use to build a safety net. With Golden Master.

What do you learn on the second day?

Here you will learn more techniques such as Seams and how you can use Test Coverage to determine what you should be writing tests for and why! After that, we'll take a look at the most important refactoring patterns you need to work efficiently with legacy code. Because after you have created your first safety net in the form of Unit Test Suite, you can calmly and relaxedly change the existing complex code and start all tests after each change to be sure that you have not broken anything. Now the question is, how do I change the code very efficiently and skillfully? This is where refactoring patterns come into their own. We will show you the most important refactoring patterns without IDEA then how to apply them even faster with the help of a development environment like IntelliJ or Eclipse.

Here you will also learn important techniques like how to break a monster class or monster method and how to extract one or more classes from a long method using refactoring patterns.

What do you learn on the third day?

On the third day you will learn more advanced techniques for working with legacy code such as mutation testing, and dependency breaking techniques. This allows you to break the complicity of legacy code. What was once legacy code gradually becomes understandable and enjoyable code that you can build on without fear of breaking anything. Legacy code slowly disappears and is replaced by clean code. This also increases the code quality tremendously and with it, of course, your productivity.

Where do we go from here?

After this course, you'll be pretty comfortable with the best techniques and know-how for working with legacy code. Because you learn each technique individually in a small workshop and thus you focus only on this technique. Unfortunately 3 days are way too short to take on a big project with legacy code. In the 3 days we can be very happy if you master the most important techniques for working with legacy code.

Now from several participants from different companies in this course came the wish for a follow-up course. A course that consists of a large project with over 5,000 lines of complex code without tests. In other words, a real legacy code project with complex database binding, with REST APIs, with monster classes and methods and with very bad dependency, with strong coupling between classes and modules and bad interface and in addition even foreign APIs. A real ugly legacy code project. Our task in this follow up course is that within 3 days we will apply all the learned techniques from the first course and here we will even learn advanced unit testing techniques like test double techniques and advanced dependency breaking techniques to gradually create test suite for the ugly legacy project and refactor the code towards clean code. This follow-up course we will Legacy Code in Action.


The Python Legacy Code course will be conducted by one of the following trainers:


Of course, as a participant in the Techniques for Working with Python Legacy Code course, you will receive a certificate. Prerequisite for this is the complete participation in all course units and programming tasks and the successful programming of a small final project. This, however, will be more fun than stressful after this intensive Python Legacy Code training.


The agenda is written in English due to the numerous technical terms. Descriptions as well as course material will be provided in German. You can book the course either in German or English.

All seminar contents are individually adapted to the wishes of our participants. They can vary depending on the level of knowledge and will be defined together with the seminar leader on day 1. In this Working with Python Legacy Code seminar you can choose from the following topics:

Working with Python Legacy Code Day 1

Necessary Basics

  • JUnit 5 Basics
  • Clean Code Basics
  • Refactoring Patterns Basics

Reasons to Change Software

  • Adding a feature
  • Fixing a bug

Safety Net Assembly

  • Golden Master
  • Seams
  • Test Coverage
  • Mutation Test

Adding a Feature

  • Test Driven Development
  • Programming by Difference

Working with Python Legacy Code Day 2

Get a Class into a Test Harness

  • Irritating Parameter
  • Hidden Dependency
  • Construction Blob
  • Irritating Global Dependency
  • Horrible Include Dependencies
  • Onion Parameter
  • Aliased Paremter

Run a Methode in a Test Harness

  • Hidden Method
  • Language Feature
  • Undetectable Side Effect

What Methods should I test?

  • Reasoning about Effects
  • Reasoning Forward
  • Effect Propagation
  • Effect Analysis

Need to make a Change

  • Many Changes in One Area
  • Interception Points
  • Characterization Tests
  • Characterizing Classes
  • Targeted Testing
  • A Heuristic for Writing Tests
  • My Application is all APIs Calls
  • My Application has no Structure
  • May Project is not object oriented

Working with Python Legacy Code Day 3

Breaking Monster Class

  • Seeing Responsibilites
  • Single Responsibility Principle
  • Moving Forward

Changing Monster Method

  • Hidden Class
  • Extract Till You Drop

Dependency-Breaking Techniques

  • Adapt Parameter
  • Break Out Method Object
  • Definition Completion
  • Encapsulate Global References
  • Expose Static Method
  • Extract and Override Call
  • Extract and Override Factory Method
  • Extract and Override Getter
  • Extract Implementer
  • Extract Interface
  • Introduce Instance Delegator
  • Introduce Static Setter
  • Link Substitution
  • Parameterize Constructor
  • Parmeterize Method
  • Primitivize Parameter
  • Pull up Feature
  • Push Down Dependency
  • Replace Function with Function Pointer
  • Replace Global Reference with Getter
  • Subclass and Override Method
  • Supersede Instance Variable
  • Template Redefinition
  • Text Redefinition

Course formats / dates

1 Day Crash Course

In München oder Online

3 Days Course

In München oder Online


Participation possible at any time

4-Wochen-Training copy

Participation possible at any time

For teams

Are you interested in a course for your team? Get in touch - we will find a perfect solution. Our professionals are also happy to come to you. Among other things, we offer:

  • In-house training
  • Technical coaching
  • Consulting
Request Request

Questions & Service

Our service team will be happy to advise you personally. Mon-Fri from 9.00 to 18.00 under:
+49 89 17958-820


BMW Apple Draeger VW Sky Siemens 2000px TÜ V Süd Logo Agfa Kopie Samsung Fraunhofer Valtech Deutsche Bank
Course Catalogue Overview of rocket courses: