Skip to content

Patterns

Good Practices

  • Keep things DRY ("don't repeat yourself")

Mocking techniques

  • Higher-Order Functions
  • Monkey Patching
  • Interface Substitution
  • Embedding Interfaces
  • Mocking out Downstream HTTP Calls with net/http/httptest

Saga

"Implement each business transaction that spans multiple services is a saga. A saga is a sequence of local transactions. Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga." More here

Memoization

"In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again"