Skip to content

Instantly share code, notes, and snippets.

@guiyanzhong
Created April 18, 2021 04:22
Show Gist options
  • Save guiyanzhong/0a69cb5cac90d87c3e80774dbf611334 to your computer and use it in GitHub Desktop.
Save guiyanzhong/0a69cb5cac90d87c3e80774dbf611334 to your computer and use it in GitHub Desktop.

Elixir Best Practices: When to Use Structs, String-keyed Maps, and Atom-keyed Maps

  • Rule #1: Always Use String-Keyed Maps for External Data
  • Rule #2: Convert External Data to Structs ASAP
  • Rule #3: Use Structs in All Other Code
  • Rule #4: Use Structs for Output Data
  • Rule #5: Avoid Using Atom-keyed Maps That Aren’t Structs
  • Rule #6: Use Keyword Lists Only for Function Arguments
@guiyanzhong
Copy link
Author

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