Closed jfroelich closed 5 years ago
Interesting article on the concept of patch: https://williamdurand.fr/2014/02/14/please-do-not-patch-like-an-idiot/
This ties into the idea of emulating a REST API for storage by introducing an intermediate layer.
Followup: consider dropping create-entry and create-feed and instead just reusing put-entry and put-feed in each case
Random thought: the rest api will provide a strict barrier between objects within the database layer and the objects outside of it in the calling context. in some sense the objects Entry and Feed should actually only be available within the rest api code, and the calling context should just get data objects.
Also, we can completely mask away the magic prop stuff to the user of the rest api. the magic prop would only matter from within the scope of the database layer. outside it is just data object that may or may not have property, and inside, we can auto-insert the appropriate magic. this will change the contract of the database api helpers that read/write data, they become only concerned with accepting data objects and returning data objects. e.g. a write function called by the caller would supply an object without magic, then internally the magic will be inserted before storage. then the read function will grab something from db, assert against magic, then strip magic and return to caller. basically magic only helps type restrictions inside of the rest api, not outside of it. outside of it, entries and feeds are just generic objects that the caller can do whatever with. This ties into that other issue of making magic fully opaque. it would also mean that no caller outside of the database layer should directly use Entry, Feed, is_entry, or is_feed.
Other and/or remaining todos:
regarding previous comment on create semantics, this is the CRUD to REST map:
I actually liked the simplicity of this description of REST: https://restfulapi.net/resource-naming/ because it went straight at some the questions I was trying to answer, and pretty much confirmed my thinking.
I think this issue is now mostly resolved.
Things to think about in the future, as separate issues:
But see this article: https://www.infoq.com/news/2015/02/service-boundaries-healthcare
Similar issue (regarding my decision to store favicon data in an entirely separate database):
These are thoughts for a separate issue. This issue is now pretty much complete.
Eventually: