011: Parse, Don't Validate episode artwork

EPISODE · Aug 24, 2020 · 52 MIN

011: Parse, Don't Validate

from Elm Radio · host Dillon Kearns

Alexis King's article Parse, Don't Validatethe difference between validation and parsing lies almost entirely in how information is preservedShotgun parsing (original academic paper)Mixing processing and validating dataShotgun parsing is a programming antipattern whereby parsing and input-validating code is mixed with and spread across processing code—throwing a cloud of checks at the input, and hoping, without any systematic justification, that one or another would catch all the “bad” cases.Why the term "parse"?a parser is just a function that consumes less-structured input and produces more-structured output [...] some values in the domain do not correspond to any value in the range—so all parsers must have some notion of failureConditionally return typesDon't have to repeatedly check conditionLook out for "lowest common denominator" built-in values being passed around (like empty String)Maybe.withDefault might indicate an opportunity to parseTwo ways to use this technique:Weaken return typeStrengthen input typeDesign by contractElm Radio JSON decoders episode

We discuss the Alexis King's article and how those techniques apply in Elm.

NOW PLAYING

011: Parse, Don't Validate

0:00 52:21

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

Frequently Asked Questions

How long is this episode of Elm Radio?

This episode is 52 minutes long.

When was this Elm Radio episode published?

This episode was published on August 24, 2020.

What is this episode about?

Alexis King's article Parse, Don't Validatethe difference between validation and parsing lies almost entirely in how information is preservedShotgun parsing (original academic paper)Mixing processing and validating dataShotgun parsing is a...

Can I download this Elm Radio episode?

Yes, you can download this episode by clicking the download button on the episode player, or subscribe to the podcast in your preferred podcast app for automatic downloads.
URL copied to clipboard!