Skip to content

Instantly share code, notes, and snippets.

@lalunamel
Last active March 3, 2018 20:50
Show Gist options
  • Save lalunamel/ff2f3249e0619dff36e65a832f8023aa to your computer and use it in GitHub Desktop.
Save lalunamel/ff2f3249e0619dff36e65a832f8023aa to your computer and use it in GitHub Desktop.
Notes on Mark Seemann's Software Design Isomorphisms

http://blog.ploeh.dk/2018/01/08/software-design-isomorphisms/

Questions

  • Where can I go to learn more about category theory

Notes

Unit Isomorphisms

unit in functional languages is isomorphic to void in OO languages

Function Isomorphisms

methods which take paramaters and use the this keyword are isomorphic to static methods and functions which take the same arguments plus an argument the same as whatever this was in the method. You can also close over (closure) whatever this was and preserve the arity of the function you're calling.

Argument List Isomorphisms

Argument lists, tuples, and objects with fields that represent all the arguments in the latter are all isomorphic.

Uncurry Isomorphisms

currying and uncurrying create functions that are isomorphic to each other? I'm not sure the point of this particualr blog post.

Object Isomorphisms

object - data with behavior closure - behavior that closes over data Objects and closures are isomorphic.

Abstract Classes and Dependency Injection

Abstract classes define the contract for something that will implement it. That contract can be turned into an interfasce which can then be injected into a component that knows how to compose it.

Inheritance and Composition

You've got the inheritance relation B --inherits from--> A such that B.method() calls A.method(), modifies its result, then returns it.

You can acheive the same result by instantiating A inside of B, and calling A.method. You can also pass A to B as a parameter. That's the decorator pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment