Database-driven applications


How applications usually get made


A 'traditional' MVC-esque architecture with an API

At each component boundary, there lies the potential for an impedance mismatch: due to some technology or system constraint, some critical piece of the information model doesn't make it across the boundary.

Error
Error type
class clojure.lang.Compiler$CompilerException
Error message
Unable to resolve symbol: ul in this context
Error phase
:compile-syntax-check
Location
Lines 33-39, Columns 1-103
Source expression
 [:ol
     [:li (ul "The data model may be difficult to express in the constraints of the storage medium (e.g. SQL)"
              "The data model is expressed too concretely in the DB (e.g. JSON columns, document stores)")]
     [:li (ul "The data model may not match the constraints of the communication layer (e.g. REST/HTTP)"
              "The API only exposes a limited subset of the information model")]
    [:li (ul "The front end, as a privileged part of the application, gets to talk to the information model directly and bypass the API's limitations")]
    [:li (ul "The API exposed to external programs only sees a limited subset of the 'true' API")]] 



A simple alternative


Schema as united information model and API

Just let a program run queries against the database. Let me make a TODO on my TODO list by transacting an assertion.

In order for this to be a viable solution, several assumptions must hold:

Error
Error type
class clojure.lang.Compiler$CompilerException
Error message
Unable to resolve symbol: ul in this context
Error phase
:compile-syntax-check
Location
Lines 52-55, Columns 1-109
Source expression
 (ul "You need a very expressive query language. (sorry, SQL)"
       "You need to give the user unmediated access to their data. (sorry, webapps)"
       "'Scalability' is not a concern. (sorry, webapps)"
       "You need to parse and validate the query to eliminate pathological/hostile inputs. (sorry, SQL)") 

In short, this solution really only works in the context of

Error
Error type
class clojure.lang.Compiler$CompilerException
Error message
Unable to resolve symbol: link in this context
Error phase
:compile-syntax-check
Location
Line 57, Columns 61-142
Source expression
(link "https://www.inkandswitch.com/local-first.html" "local-first software")

.