News for hackers. Stuff that matters.
Re:FlexBuffers by mzaks on Sunday June 21, 2020 @12:00AM (#23589638)
One use case where schema-less is the way to go, when you provide the infrastructure, but have no „ownership“ of data it will be used for. E.g. you build a logging or analytics tool where customers can send arbitrary data. Or a document database as a matter of fact. There schema-less / self described data is a must.
Re:FlexBuffers by kentonv on Sunday June 21, 2020 @12:26AM (#23589750)
Not necessarily. For logging/analytics, you could have customers upload their schema when configuring the service. I would think that doing so would allow for some powerful optimization opportunities, enabling your service to save quite a bit of CPU and maybe some bandwidth, too. It would probably also allow you to provide a better user experience, like making it easier to construct dashboards and such because you actually know how the data is structured.

For a document database, I don't agree at all. Some time back I spent more time than I'd like developing on Mongo, and boy did I wish I could actually tell it the schema of documents in each collection and have it enforce that (not to mention optimize based on it). A lot of developers actually use libraries on top of Mongo to define and enforce schemas.

Re:FlexBuffers by jd_mongodb on Sunday June 21, 2020 @08:39AM (#23591699)
You can apply a Schema to your collection and have MongoDB enforce it . This has been in MongoDB since version 3.6. We support the JSON schema standard. https://docs.mongodb.com/manual/core/schema-validation/
Re:FlexBuffers by kentonv on Sunday June 21, 2020 @10:12AM (#23592118)
Cool! My time using Mongo was pre-3.6 so I didn't know about this.
Re:FlexBuffers by mzaks on Sunday June 21, 2020 @02:48AM (#23590350)
True, I guess it all boils down to ease of use (convenience). You can build a system which accepts schema + data and build dash boards and data relevant relevant processing + optimisations, but that results in a much more complex system with higher entry burden. Sadly convenient systems always get broader adoption.
Re:FlexBuffers by kentonv on Sunday June 21, 2020 @10:14AM (#23592133)
Yeah, I see this as pretty similar to the debate over type-safe vs. dynamic languages. It used to be that people argued that dynamic languages were just way easier to use, and type-safe languages were just an optimization. But I think the real issue was that the tooling enabled by type-safe languages didn't exist yet. These days, TypeScript is no faster than JavaScript but is very popular, because of the tooling it enables, like editors with auto-complete and jump-to-definition.

I think protocols still don't have the level of tooling that makes it really obvious why schemas are better.

Re:FlexBuffers by lrem on Sunday June 21, 2020 @02:53AM (#23590366)
I own a service where users simply upload their schemas along their data. Doesn't seem to be a major issue.