Python 07: Clean Code Python
Clean Code practical course with Python

You already know how to code in Python, but want to improve the quality of your code and write high-quality, clean, well-structured and less error-prone code? Code that is easy to extend and easy to test? Then this practice clean code course with Python is made for you. With the knowledge you gain and the best practice methods you learn, you'll be able to take your code to the next level and demonstrably increase productivity and quality. Learn more about this course.

Benefits

  • Learn Clean Code rules quickly and use them in practice
  • Significantly increase code quality through clean code rules
  • React faster to new requirements and adaptations
  • Optimize and better structure existing Python code
  • Increase productivity, performance and quality

This Clean Code course for Python programmers teaches you to write high quality code. The benefits of this are many. Because if you follow the Clean Code rules well, you produce a clearly structured code that is easy to understand, test and extend. Clean Code is less error-prone and can react to changes better and faster. You or other programmers can then easily extend the code, and debugging also takes significantly less time with Clean Code. In summary, those who master Clean Code are more productive, faster and produce significantly better code. Every Python programmer should have such best practices and know-how in his or her skill toolbox.

Course formats

1-DAY CRASH COURSE

Live-Training

Live oder online large

Teaching material

Lehrmaterial

Video-Clips

Video clips
3-DAY INTENSIVE COURSE

Live-Training

Live oder online large

Teaching material

Lehrmaterial

Catering

Snacks large
4-WEEK TRAINING PROGRAM

Live-Training

Online large

Teaching material

Lehrmaterial

Video-Clips

Video clips

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

Contents

The course covers a selection of the following topics:

  • Clean Code?
  • Code Rote?
  • Risk Management
  • Names Rules
  • Functions Rules
  • Exception Rules
  • Comments Rules
  • SOLID Principles
  • Exkurs: Pytest & TDD
  • Python Best Practice
  • Code Smells

For more details, please see the agenda below.

Prerequisites

This Clean Code course is designed for software developers and programmers with a solid and good knowledge of Python, comparable to our Python for Beginners 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

Description

This three-day course is ideal for Python programmers who want to write better code and transform existing code bases into significantly cleaner code. Clean Code means: clearly structured, very good readability, compact and efficient. Such high quality code is intentionally easy to understand and extend. This increased flexibility enables large development teams to react more quickly to new and changing requirements. Even complex applications can be written faster, more safely and, above all, in more readable and accessible ways with the Clean Code approach. It can significantly reduce the long-term cost of code development and maintenance. The Clean Code course takes your code to the next level and is proven to increase productivity and quality.

What do you learn on the first day?

As motivation for this exciting and important topic, we first look at the four symptoms of bad code and bad architecture (rigidity, fragility, inseparability and opacity) and put ourselves in the role of a manager whose project is progressing very slowly and constantly produces errors. Deadlines are not met, teams are annoyed and customers are outraged and dissatisfied.

We find out what he should do now and for what reasons. We then turn our attention to the term "clean code": what is it, how can you recognise good code and how can you quickly learn stylish clean code? To produce clean code, we need to apply certain rules and techniques at various points in our Python program. A simple Python program consists of names for variables, functions, parameters and functions. You will learn the important rules for names and functions and how to break a big function into several small ones. Then we look at some best practices for working with lists and dictionaries.

A sophisticated Python program then uses object-oriented programming. Here we also see best practice for blasses and interfaces.

What do you learn on the second day?

After the first day, you already know all the important rules for creating clean code, but only within a class. On the second day, we devote ourselves to the questions: How should our classes interact with each other, how should we design classes in such a way that new requirements are ideally only possible through extensions and not through modifying and changing existing code? How and when do I break my class into multiple classes and why? How can I assign modules to Team A and Team B so that both teams develop independently? What is the meaning of the rule: "Program to an interface not implementation", which we read in every textbook on Clean Architecture and Code? How do we implement it correctly? We will answer all these questions with so-called SOLID and GRASP principles, using exciting code examples and programming tasks. SOLID is an abbreviation for 5 techniques (Single Responsibility Principle, Open/Closed Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle).

In our experience, SOLID is characterised by the fact that it is not easy to plan or implement. But if a programmer has mastered SOLID, he can immediately see whether his programme violates SOLID or not. If his programme violates SOLID, then he can ask himself why: Are there good reasons for this? If the answer is no, then he can now very easily change his code so that it no longer violates the SOLID rules. However, we find the name "Principle" a bit exaggerated: SOLID are very good clean code and architecture rules, the application of which usually leads to a well-structured and clearly defined code. Nevertheless, one should not and must not always use SOLID blindly. There are also good reasons against SOLID from time to time.

The SOLID rules make the code flexible, but also bring more complexity. You almost always have to make compromises: If you need the flexibility, then you also have to accept the complexity. Therefore, every programmer should always ask himself the question: Why did I violate SOLID? Are there good reasons for it? In any case, every good programmer should master the SOLID rules, add them to his know-how and toolbox and apply them with common sense. In order not to treat all this too abstractly, you will implement all SOLID rules by means of small programming tasks and see for yourself if and when this is worthwhile for you.

What do you learn on the third day?

We want to produce clean code, code that is not only easy to understand, but that also works properly. Therefore, the topics of unit testing and test-driven development (TDD) are undoubtedly part of this. We will take a quick excursion into pytest and also into TDD, which consists of 3 phases (RED-GREEN-REFACTORING). Through simple examples and programming tasks you will get to know these 3 phases in action and quickly get a feel for them. If you are more interested in Unit Testing and TDD, you can also attend our separate course Unit Testing with Python at the Munich Coding Academy.

Now you already know all the important clean code rules for one and several classes and even unit testing. What's missing now: In large projects, you usually have to work with code that you didn't write yourself. You should write new code based on existing code and therefore you have to understand it and modify and extend it if necessary. How can you tell if the existing code quality is good enough or not? The answer is relatively simple: If the existing code violates the Clean Code and SOLID rules and has no or only poor tests, then the probability is quite high that it is code with poor quality. This is exactly why there is a catalogue for the so-called code smells.

Code smells are code that smells of errors and complexity. This is even put very diplomatically. Code smells is code that simply stinks because it is so badly written. Such bad code slows down development and reduces productivity and joy in programming. The first step in eliminating such bad code is to recognise it immediately; this is initially a matter of practice and experience. Nevertheless, there is a catalogue for Code Smells (Names, Functions, Comments and Test Smells) with over 20 patterns. We look at the most important patterns that can be used to turn bad code into good code, using many code examples and best practice techniques. This task - turning bad code into good code - is extremely important and very challenging, because it requires knowledge of refactoring patterns and can only be learned through intensive practice and many programming tasks. For this reason, we offer an additional course "Working with Legacy Code in Python" for this purpose, which is the ideal companion for working with legacy code.

YOUR TRAINERS

The Clean Code course for Python programmers is conducted by one of the following trainers:

CERTIFICATE

Of course, you will receive a certificate as a participant in the Clean Code with Python course. The prerequisite for this is complete participation in all course units and programming tasks and the successful programming of a small final project. This, however, will give you more pleasure than stress after this intensive Python course.

AGENDA

The agenda is written in English due to the numerous technical terms. You will receive descriptions and course material in German. You can book the course in either 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 are defined together with the seminar leader on day 1. In this Python seminar, you can choose from the following topics:

Python Clean Code Day 1

Code Rote

  • Bad Code
  • Productivity Problem
  • Manager Reaction
  • Code Rote
  • Rigidity
  • Fragility
  • Inseparability
  • Opacity

Clean Code

  • Definition: Boosch
  • Definition: Stroustrup
  • Definition: Cunningham
  • Definition: Feathers

Names Rules

  • Good Name
  • Bad Name
  • Ottinger's Rules
  • Intention-Revealing
  • Pronounceable
  • Searchable
  • Describe the Problem
  • Avoid Desinformation
  • Meaningful Distinctions
  • Avoid Hungarian notation
  • Parts of Speech
  • Scrope Length Rules

Functions

  • Function Grammar
  • Big Function
  • Extract Rule
  • Step-Down Rule
  • Command-Query
  • Parameter List Rules
  • Maximal three Arguments
  • No Boolean Argument
  • No output Argument
  • No null Argument
  • Statement Rules
  • Do One Thing Rule
  • Small Function Rule
  • Hidden Classes Rule
  • Minimize Side-Effect
  • Avoid Switch

Error Handling Rules

  • Error Handling First
  • Prefer Exception over Values
  • Exception Classes

Comments Rules

  • Good Comments
  • Legal Comments
  • Informative Comments
  • Explanation of Intent
  • Clarification
  • TODO Comments
  • Bad Comments
  • Mumbling Comments
  • Redundant Comments
  • Misleading Comments
  • Mandated Comments
  • Journal Comments
  • Noise Comments
  • Scary Noise Comments

Python Clean Code Day 2

Object-Oriented 

  • What is object-oriented
  • Dependency Management
  • Dependency Inversion

SOLID Principles

  • Single Responsibility
  • Open Close
  • Liskov Substitution
  • Interface Segregation
  • Dependency Inversion

Python Clean Code Day 3

Unit Test

  • Life Cycle and AAA Rules
  • Pytest
  • Parameterized Tests

Test Driven Development

  • What is TDD?
  • RED Phase
  • GREEN Phase
  • REFACTORING Phase

Code Smells: Names

  • Bad names
  • Unambiguous Names
  • Encodings Names
  • ...

Code Smells: Function

  • Too Many Arguments
  • Output Arguments
  • Flag Arguments
  • Dead Function

Code Smells: Comments

  • Inappropriate Information
  • Obsolete Comment
  • Redundant Comment
  • Commented-Out Code

Code Smells: Test

  • Insufficient Tests
  • Test Ambiguity
  • Exhaustively Test
  • Slow Tests

Course formats / dates

1 Day Crash Course

In München oder Online

3 Days Course

In München oder Online

4-Wochen-Training

€1,876.00
Participation possible at any time

4-Wochen-Training copy

€899.00
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
info@coding-academy.com

References

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: