You Don't Need That!

by Christopher Neugebauer

design patterns best practices

Not every design pattern makes sense in Python. This talk builds up design patterns commonly used in enterprise languages, and shows the features in Python that make these approaches unnecessary.

Software design is hard. That's why we invented design patterns. Design patterns abstract common approaches to problem solving into generic approaches that can be modified to suit the application at hand. Many of the design patterns in common use today are inspired by static object-oriented Enterprise languages like Java. These languages have a feature set that is somewhat more restrictive than Python's, and many design patterns are built to provide elegant ways around these restrictions. Design patterns, like Dependency Injection, and the Visitor Pattern arise from restrictions on how you can pass code around at runtime. Other patterns, like Iterators, have been replaced by first-class language features of their own. And some patterns, like Threads just never worked at all. In this talk, we'll build up several design patterns, and then look at the Python features that make each pattern unnecessary. In doing so, you'll get a view into idiomatically translating code into Python, and a greater understanding of design decisions users of other languages need to make.