Forget Case in Elixir

How to get the case out of the way

Photo by Yung Chang on Unsplash

Case Hides Intent

Snippet below shows how it is hard to untangle the code. You get the response from calling the genserver and handle cases. Simple function can do that, pattern matched to handle each case.

@spec supervise_video_worker(Atom.t, String.t) :: any()
def supervise_video_worker(api_scope, path)…

--

--

--

Java and dev lifestyle stories. Subscribe for limitless reading: https://zivce.medium.com/membership Check out some of my e-books: https://zivce.gumroad.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

KOT — KOLS OFFERING TOKEN AIRDROP

Solafarm Roadmap

Pokie Megaways Slot Review

Pokie Megaways Slot Review

Snippets in C#: Offsets and substrings

Work Logs

Prove rev (rev L) = L in CafeOBJ

GITOPS — Continuation of the cloud journey

7 deadly sins of a Scrum Master

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Miloš Živković

Miloš Živković

Java and dev lifestyle stories. Subscribe for limitless reading: https://zivce.medium.com/membership Check out some of my e-books: https://zivce.gumroad.com/

More from Medium

Monads as Practical Functionality Providers

Unit Testing User Interactions

Performance Optimisation — Advanced FP part 3

Elixir — A Tincture for Functional Programming Part 1.5 Recursion

Ouroboros