Hack hack hack...

An open journal-- some of it written for you, but most of it is for me.

Gang of Four: Proxy and Adapter Pattern

Proxy

  • reverse proxies
  • virtual proxy: creates expensive objects on demand. the worker box maybe?
    • infinite scroll or pagination (these objects exist in Octokit, where there are objects as placeholders but it hasn’t acutally fetched the data)
    • memoization example in the ruby boook
    • collection proxy

Adapter (aka wrapper)

  • Fog: cloud storage
  • ActiveRecord
  • OctokitWrapper is more of a decorator because it adds additional implementation on top of Octokit
  • Gateway pattern is an adapter specifically created to talk to external services
  • HierarchyBuilder is the adapter
  • The key difference between bridge and apater lies in their intents.
    • Adapter focuses on resolving incompatibilities between two existing interfaces. Bridge, on the other hand, bridges an abstraction and its (potentially numerous) implementations.

Comments