Zen and the Art of Abstraction Maintenance

Alex Martelli (Google)
Programming, Python
Location: Ballroom A3/A6
Average rating: ***..
(3.79, 14 ratings)

Programming builds abstractions on top of abstractions: we use (“consume”) some layers in a stack of abstraction, and often build (“produce”) new layers towards the system behavior we desire. While most “knowledge work” relies on abstractions (when the work can be characterized as “communication”, building abstractions is also common), this talk focuses on programming, where such issues are burningly important, technical, and real, on a day-to-day basis.

Like leverage in financial operations, abstractions are precious, indeed indispensable, in programming. You can’t build a useful program focusing on how your code makes computer transistors switch back and forth… and if you COULD usefully think in such lower-layer terms, you’d still be using layers of abstractions, by thinking of transistors rather than quanta and quarks;-) Just like leverage, abstractions can be dangerous in proportion to their power, liable to make the whole system “explode in your face” unless handled with prudence and awareness… and that’s what this talk is all about.

Joel Spolsky’s “Law of Leaky Abstractions” focuses on one cause of danger: “All non-trivial abstractions, to some degree, are leaky”. Implementation aspects inevitably “show through” at the most inopportune moments… bugs, anomalies, system overloads, security attacks. You need awareness of a few layers that are lower on the stack than the level you’re working at (i.e., awareness of the “implementation details” that every pundit tells you to ignore!-) to architect your software for efficiency, robustness against security attacks, ability to debug when the need arises. The temptation to ignore all layers below your chosen one must be resisted.

But wait, there’s more! Abstractions, often, should leak… in a designed, deliberate fashion. The best way to customize a stack of abstractions will often be to layer yet more on top… but, not always: sometimes, “hooking up” extra or modified functionality at lower layers offers more powerful AND safer leverage than building a too-thick superstructure. Keep this in mind when you produce abstractions: are you offering appropriate “hook points” to let an advanced consumer of your abstractions tweak and customize them towards their goals, which you cannot fully anticipate?

As an abstraction consumer, look for the hooks (don’t be surprised if they’re poorly documented…!) and consider their appropriate uses. Breaching the “architectural wall” between layers (making the abstraction leak by force, when it wasn’t designed to), e.g. by the alas-too-popular technique of “monkey-patching”, is a desperate measure that should only be used, if ever, to wiggle out of the very direst straits: if you’re using an abstraction stack that just won’t let you get your job done without going to such extremes, you’re probably better off switching to a completely different one!-)

Photo of Alex Martelli

Alex Martelli

Google

Alex Martelli wrote “Python in a Nutshell” and co-edited
“Python Cookbook”. He’s a PSF member, and won the 2002 Activators’ Choice Award and the 2006 Frank Willison Award for contributions to the Python community. He works as Senior Staff Engineer for Google. You can read some PDFs and
watch some videos of his past presentations.

Comments on this page are now closed.

Comments

Picture of Mark Fink
Mark Fink
07/24/2009 10:31am PDT

I liked this talk a lot. I was fun and gave in depth background on how to use abstractions. Very helpful. Thanks.

Cole Tuininga
07/22/2009 11:18am PDT

A heady and abstract talk … and very interesting.

  • Intel
  • Microsoft
  • Google
  • SourceForge.net
  • Sun Microsystems
  • Facebook
  • Gear6
  • Kaltura
  • Liferay
  • MindTouch
  • MySpace.com
  • Novell, Inc.
  • Open Invention Network
  • Rackspace Cloud
  • Schooner Information Technology
  • Silicon Mechanics
  • Symbian Foundation
  • Twilio
  • WSO2
  • Yabarana Corporation

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at scordesse@oreilly.com

Download the OSCON Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com

OSCON Newsletter

To stay abreast of conference news and to receive email notification when registration opens, please sign up for the OSCON newsletter (login required)

Contact Us

View a complete list of OSCON contacts