Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miguel-vila/816407f363a85ce33ae8 to your computer and use it in GitHub Desktop.
Save miguel-vila/816407f363a85ce33ae8 to your computer and use it in GitHub Desktop.

Jessica Kerr "Functional Principles for Object Oriented Development"

Principles

  • Data In, Data Out: (Most) Functions should only depend on its parameters and should do nothing but produce output.
    • Testable: No need to setup extern dependencies or tear them down after testing
    • Easier to understand: Only local context dependent
    • A good "data in, data out" function should:
      • don't access global state
      • don't modify the input
      • don't bother the rest of the world
  • Inmutability
    • Default mutability = Accidental complexity
    • The less state you can change the less you must think about
    • Threadsafe by definition
    • A mutable class can be changed ANYWHERE
    • Google's Guava -> inmutability in java
  • Declarative style
    • Familiar != Readable
    • Type alias help: type FirstName = String
  • Laziness
    • Guava iterable -> lazily evaluated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment