Skip to content

Instantly share code, notes, and snippets.

Geoffrey Clements baldmountain

  • Massachusetts
Block or report user

Report or block baldmountain

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mocks cheat sheet
stub = stub("stub")
customer = double("customer")
# single stub
customer = double("customer", :name => 'Bryan')
# multiple stubs
customer = double("customer", :name => 'Bryan', :open_source_projects => ['WebRat', 'Rack::Test'])
# single stub
View rvm install ruby on snow leopard
rvm install 1.9.1 -C --with-readline-dir=/Developer/SDKs/MacOSX10.6.sdk/usr

2010 Modularity Olympics

This is a contest, open to programming languages from all nations, to write modular and extensible code to solve the following problem: Implement a service that can run queries on a database.

The Challenge

Sounds simple right? Wrong! A programmer without control over the source-code of that service must be able to later add enhancements such as statistics collecting, timeouts, memoization, and so forth. There are a few more requirements:

  1. the “enhancements” must be specified in a configuration object which is consumed at run-time (e.g., it could be based on user-input).
  2. The enhancements are ordered (stats collecting wraps timeouts, not the other way around) but it must be possible to reverse the order of the enhancements at run-time.
  3. The enhancements must be “surgical” and not “global”. That is, it must be possible to simultaneously have two query services, one reversed and one not reversed, and even have a query service without any enhancements.
You can’t perform that action at this time.