Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.37 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.37 KB

About

This is an attempt to model domain in semantic shapes.

Problem

Let's say we try to model User domain.

User has attributes: id, first, last, address.

Address has attributes: city, zip, state.

If we try to implement the following functions:

  • createUser(first, last, address.city, address.zip, address.state): ExistingUser
  • greet(UserWithName): String
  • userGeo(UserWithIdAndAddressZip)
  • getUserWithoutAddress(): UserWithoutAddress
  • getUser(): User

We quickly realize that:

  1. We get a combinatorial explosion in data classes proliferation
  2. Every class is not compatible with each other. For example User has to inherit UserWithoutAddress. So that in places where function expects UserWithoutAddress we should be able to provide User.
  3. To make them compatible we also have to write interfaces for each of them.

Inspirations:

Ideas to explore: