eggheadio / egghead-design

Illustrations and design elements for egghead.io
http://egghead.io
25 stars 4 forks source link

Safer JavaScript with the Maybe type #105

Closed zacjones93 closed 6 years ago

zacjones93 commented 6 years ago

https://egghead.io/courses/safer-javascript-with-the-maybe-type

JavaScript’s dynamic typing makes it incredibly flexible. That flexibility can lead to trouble though. When values have the potential to change types, or to end up as null or undefined, that can lead to runtime errors in our code or bizarre bugs that take forever to track down because of type coercion. To battle this, we end up with code that is littered will conditionals for null or undefined values and type checks, making the core logic harder to read and refactor later. The Maybe encapsulates the type checking and guards against missing values for us. This means we can keep our functions free of all the guardrails, outsource that work to the Maybe and keep our business logic free of all the clutter.

MaggieAppleton commented 6 years ago

https://www.dropbox.com/sh/oiw1azghqe5da1i/AAByVIVKY8imyyUBEzAcES5aa?dl=0