O'Reilly logo

Exercises in Programming Style by Cristina Videira Lopes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15

Bulletin Board

image

15.1 Constraints

  • Larger problem is decomposed into entities using some form of abstraction (objects, modules or similar).
  • The entities are never called on directly for actions.
  • Existence of an infrastructure for publishing and subscribing to events, aka the bulletin board.
  • Entities post event subscriptions (aka "wanted") to the bulletin board and publish events (aka "offered") to the bulletin board. The bulletin board infrastructure does all the event management and distribution.

15.2 A Program in this Style

  1 #!/usr/bin/env python
  2 import sys, re, operator, string
  3
  4 #
  5 # The event management substrate
  6 #
  

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required