Design Patterns in Python (original) (raw)

Course Data

Course name: Design Patterns in Python
Course length: 1 day
Remote: Yes
Open course: No
In-house: Yes
Course ID: DPE
German course here

Course Finder

Find the right course for your needs..

Combining Topics

Company courses allow to assemble trainings combining topics from different courses.

Course Topics Overview as PDF

You can download our flyer. It has an overview of all our course topics.

Motivation

Frequently, tasks can be solved following some pattern. Design patterns can be used to group tasks and their solutions. Often problems can be solved with existing patterns. Furthermore, patterns offer a common language for developers with well defined terms to communicate about complex tasks.

Course Content

Special Features of Design Patterns in Python

In Python many problems can be solved more easily than in other languages. Therefore, several design patterns are not necessary or they are already implicitly contained in the languages.

The Principles of writing pythonic programs are explained and supported with examples. Topics such as beauty of source code, explicit programming, simplicity, readability, and exception handling are included.

“It’s easier to ask for forgiveness than permission (EFAP)”

One pythonic principle is “It’s easier to ask for forgiveness than permission (EFAP)”. Opposed to the approach to look before you leap, this principle states that you should first try an action and if it fails react appropriately. Python’ strong exception handling supports this principle and helps to develop robust and fault tolerant programs.

Singelton

Singeltons are objects of which only one instance is supposed to exist. Python provides several ways to implement singeltons. These possibilities are shown using examples.

Null Objects

Null objects can be used instead of the type None to avoid tests for None. Implementation, usage as well as advantages and disadvantages are covered.

Proxy

Proxies stand for other objects. Setup and usage of proxies are covered.

Observer

The observer pattern allows several objects to have access to the same data. The principles of this pattern are shown with a comprehensive example.

Constructor

Parameters of constructors are often assigned to instance variables. This pattern can replace a many lines of manual assignment with only one line of code.

Exercises

The participants can follow all steps directly on their computers. There are exercises at the end of each unit providing ample opportunity to apply the freshly learned knowledge.

Course Material

Every participant receives comprehensive materials in PDF format that cover the whole course content as well as all source code.