Alex Hoffman

Random thoughts and ramblings

Borg Design Pattern (Monostate)

... the Borg design pattern (http://code.activestate.com/recipes/66531/) by Alex Martelli, that works great on 99% of the time when you need a singleton, and yet remains freaking simple.

The Original Borg Pattern by Alex Martelli:
class Borg:
  __shared_state = {}
  def __init__(self):
    self.__dict__ = self.__shared_state
  # and whatever else you want in your class -- that's all!

Posted

Purchased Resolver One spreadsheet to evaluate its use as a custom complex leasing calculation engine

Posted