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...
All courses live
In the Academy or online
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
Description
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.
YOUR TRAINERS
CERTIFICATE
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.
AGENDA
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