Three Tiers of Decoupling in Elixir
Allow me to weave you a tale of progressively stronger decoupling in Elixir. I am working on a library that involves access to graph data, informed by a schema or model. Just to get things rolling I started out with a convention of holding graph nodes in a map: map_graph = %{"node1" => %{"class_id" => "class1", "data" => %{ "testProp" => "value" }} %{"node2" => %{"class_id" => "class1", "data" => %{ "testProp" => "value2" }}} node = map_graph["node1"] value = node["data"]["testProp"] It’s quick, dirty, and gets the job done for proof-of-concept purposes. Clearly it’s inadequate for other data access patterns we’d like to be able to support. We can write transformation routines against this structure, but they won’t be able to work with anything else. ...