Ok, so last time I said there would be some designs in this post. That was a complete fabrication. (Or maybe an enhancement of the truth?)
I’ve been thinking a lot about harder problems: 1: I love Web Components. 2: Polymer has all the compatibility of car components (ie it only runs on Chrome).
So I’m leaning more towards Mozilla’s X-Tags to do some of the heavy lifting of Custom Elements, use HTML Imports, and leave Shadow DOM out of the picture. The problem with this is that X-Tags does approximately nothing for you with regards to templating, data binding, or anything else you need to do.
For some reason, I also want to move away to jQuery. Vanilla JS has come a long ways since 2004, and maybe if I use less frameworks of questionable utility, the lighter the app will be. To that end, I wrote doubledollar.js, a simple wrapper around some of the pain points of DOM (web components stuff, abbreviations of common operations, AJAX things, some promise stuff, etc). I expect to develop it more as I dig more into Leatherbound.
One the data side, I had a painful reminder that I’m no longer in key-document land and that Google Cloud DataStore (aka BigTable) stores simple schemaless records. So I had to do some actual thinking as to my data store.
What I’m thinking is that an entire post is stored as (sanitized) HTML in a single value in the database. Make sure that user-facing content and searchable text are in the text content of it. We’re already making heavy use of custom tags in front-end, so why not use them in the data store, too? The software can semantically know exactly what happened, widgets can be updated, and the messy implementation details (like the code to embed a video) don’t appear in the DB. Use tags like <lb-event>
, <lb-picture>
, <lb-tag>
, <lb-mention>
, etc. The software can easily parse these out for various reports (lists of media, tag clouds, etc).
For indexing, hash-tags and at-mentions would need to be also stored, but I consider these cache columns for the benefit of querying.
My next problem is the posting and editing process. Because of uploading media, posting an entry is not a simple POST request, but several. Clean up of media of deleted posts would need to follow (unless I take the tumblr approach and store everything forever). The alternative is to upload all the media at once, but this sounds like a recipe for bad user experiences (long post time, higher chance of failure, and unusual behavior).