Decorators as composable abstractions

Talks | Submit a talk
Authors Sidhant Godiwala
Talk Type talk
Level Intermediate
Topic Core Python (including Python 3.x)
Tags decorators, abstractions, design patterns
Summary

"Higher order" functions are functions which take functions as arguments, return functions as results or both. They can be used to create very powerful yet completely composable abstractions.

Decorators are syntactic sugar for creating higher order functions in Python and I'm going to show you how you can use them to introduce a new level of succinctness into your code.

Outline

In 2010, at Clojure Conj, Mark McGranaghan gave a talk on composable abstractions in Clojure, using his Ring framework as an example.

I was very impressed with Ring, and Mark's talk resonated with my view on how programming could be.

At InfinitelyBeta (in production) we have a framework for implementing libraries for REST APIs which makes exhaustive use of decorators and results in code that is both flexible and readable.

My talk will use a subset of this framework as an example to illustrate the concept of composable abstractions

I will cover the following,

  1. A basic introduction to higher order functions
  2. An overview of decorators and types of decorators
  3. A description of the problem (multiple custom REST libraries)
  4. A solution to the problem using decorators
  5. Show running code
  6. Bringing it all together with composable abstractions
  7. QnA
Notes
Profile of the authors

Software developer at Infinitely Beta. Enjoys functional programming and building to scale. Also a hobbyist game developer.

blog - http://blog.sidhantgodiwala.in/ github - http://github.com/grinnbearit/ hackernews handle - grinnbearit

Files
file size uploaded comment
Decorators_as_Composable_Abstractions.pdf 92.8 KB August 31, 2011

You can upload or delete a file if you are author of this talk.