DEV Community

Discussion on: You Either Have It Or You Don't

Collapse
 
zerg000000 profile image
albert lai

when you focus on pure data.

what is the different between

{:name "mr. b" :age 12}
{:name "mr. b" :age nil}
{:name "mr. b"}
{:name nil :age nil}
{}
nil

what's the problem maybe could solve?

Collapse
 
deciduously profile image
Ben Lovy

True, but how do you encode business requirements? What does the defrecord look like? Is this what spec is for?

Collapse
 
michelemauro profile image
michelemauro

It is different if you have different use cases on when :name has been specified, or not.

In a static type system, those use cases are encoded in a type, which becomes integral part of the information carried by the data. In dynamic type systems these are (hopefully) encoded in documentation and tests.

There is place and use for both systems.