Skip to content

Instantly share code, notes, and snippets.

View baldmountain's full-sized avatar

Geoffrey Clements baldmountain

View GitHub Profile
const testFunction = () => {
let propertiesA = {a: 1, b: 'A', c: 5, config: {a: 2}};
let propertiesB = {a: 2, d: 4, f: 6, person: 'Tom', config: {a:5, b: 10}};
let newObject = coolfunction(propertiesA, propertiesB)
return coolfunction(objA, objB);
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
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.