Indrajit Rajtilak

@rtindru

Design Patterns and Where to Find Them (Python Edition)

Submitted Sep 15, 2017

Discovering Design Patterns hiding in plain sight in the Python ecosystem. From adapter pattern in Allauth, iterator in Django Querysets, various decorators used in Django, strategy patterns in SKLearn, and Observer pattern in Django Signals, this talk will uncover interesting usages of Design Patterns in familiar libraries!

The book “Design Patterns” by the Gang of Four (GoF) offers timeless elegant solutions to common problems in software design. However reading about Design Patterns in the abstract is far from ideal, and the C++ examples in the book don’t always map well to the python ecosystem.

The goal of this talk is to bridge the gap between abstract concepts to concrete understanding of Design Patterns. The talk will introduce a key design pattern, reference an implementation in the Python ecosystem, and highlight key differences (if any). This allows the audience to truly understand these Design Patterns in a comfortable setting, by looking at familiar system and third-party libraries that implement these patterns.

Key Takeaways:

  • Better undertanding of Design Patterns as it applies to Python, and in general.
  • Understand the crux of the Design Patterns we discuss, how, where, when and why it is used.
  • Key differences between a traditional and Pythonic view of Design Patterns.
  • Concrete examples to visit when you’re looking to implement your!
  • Challenge the idea that a language like Python does not (or need not) adhere to Design Patterns.

Outline

  • Introduce Design Patterns and why we study them
  • Creational, Structural & Behavioral Patterns
  • Adapter Pattern: Introduction, Python Usage, Key Differences
  • Decorator Pattern: Introduction, Python Usage, Key Differences
  • Iterator Pattern: Introduction, Python Usage, Key Differences
  • Startegy Pattern: Introduction, Python Usage, Key Differences
  • Proxy Pattern: Introduction, Python Usage, Key Differences
  • Command Pattern: Introduction, Python Usage, Key Differences
  • What next?

Requirements

A general idea of what each of the design patterns mentioned in the talk are about
A laptop with core python system libraries and some third-party libraries
An IDE to browse the code and look at the patterns in action

Speaker bio

Indrajit is a Lead Backend Developer at Springboard, an Ed-Tech startup. A Pythonista and an avid Django developer, Indrajit loves building cool apps both at work and at Hackathons! He won both editions of Djangothon, a Django hackathon by Hackerearth and the Walmark Labs HackFest in 2015. He has spoken at multiple meetups including a Django 101 Workshop and a talk on Django ORMs. When he’s not coding, he enjoys Dota, a cold Beer and Football!

Slides

https://docs.google.com/presentation/d/1LeuTX898FdrD6e7Z9TPc3E1gM369WqyvjKt0c94BLR8/edit?usp=sharing

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

PyCon Pune 2017 more