Much of TTM and related writings deals with what’s wrong with SQL and how it should be done better. SQL is an essential part of the communications between applications and databases, in conjunction with an ORM of some kind. Which kind of points to a similar role for the language D. At least that’s the way it has seemed to me.
My question is: would it be better to think of D not so much as a replacement for SQL as the language in which to code an application data model?
Using a slightly modified version of my 4 layers, and just thinking about a modest web app:
- UI access: coded in HTML, CSS and JS.
- Glue code: written in GP language: Java, C#, ruby, etc
- Data model: coded in GP language.
- DBMS access: coded in GP language and SQL.
By data model here I mean the totality of the state of the business data that models the application, both transient and persistent. The idea would be to code layer 3 entirely in a suitable D. It would draw together data from a variety of sources, and is free to use SQL and a DBMS for persisting or retrieving data.
And that leaves me pondering two questions.
- What specific D features are required to fully implement a data model? Scoped constructs like functions or modules are vital, I think.
- What should the API between application and data model look like? POCOs rather than relvars I think.
All of a sudden this sounds like a bigger project.