News for hackers. Stuff that matters.
Re:Things I wished more developers knew about databases by MaxBarraclough on Wednesday April 22, 2020 @10:43AM (#22946069)
> I suspect this was what attracted developers to noSQL databases like Mongo in the first place -- it's more attuned to a programmatic mindset.

Well, it's more attuned to the dynamically typed mindset, sure. Programmers who understand the value of static type systems should understand the value of relational schemas.

Re:Things I wished more developers knew about databases by andybak on Wednesday April 22, 2020 @11:25AM (#22946538)
I disagree. There's more to relationships that typing. I'm very pro-dynamic languages and still chafe at static typing but the wonder of the relational model fits nicely with my liking for declarative and functional approaches.

(EDIT - and as another data point I dislike SQL's syntax. The semantics are bearable but the syntax just makes my brain melt)

Re:Things I wished more developers knew about databases by MaxBarraclough on Wednesday April 22, 2020 @11:42AM (#22946753)
They're not identical concepts, but both relational schemas and statically typed programming languages provide assurances about basic structure. Mongo, and Python, offer no such assurances, and leave it to the developer to get it right.

Agree that SQL's syntax is rather bad.

Re:Things I wished more developers knew about databases by MaBeuLux88 on Wednesday April 22, 2020 @12:35PM (#22947391)
MongoDB supports Schema Validation since MongoDB 3.2 (Dec. 2015) and JSON Schema since MongoDB 3.6 (Nov. 2017) so MongoDB can enforce types strictly if you want to at the collection level. NoSQL doesn't mean NoSchema or NoTypes. https://docs.mongodb.com/manual/core/schema-validation/#json...
Re:Things I wished more developers knew about databases by MaxBarraclough on Wednesday April 22, 2020 @01:05PM (#22947747)
So they bolted it on eventually then. The relational databases went the other way and bolted-on schemaless data [0] [1]. We can still compare the schema-based and schemaless approaches.

[0] https://www.postgresql.org/docs/10/datatype-json.html

[1] https://docs.microsoft.com/en-us/sql/t-sql/functions/json-qu...

Re:Things I wished more developers knew about databases by andybak on Thursday April 23, 2020 @06:15AM (#22954425)
> both relational schemas and statically typed programming languages provide assurances about basic structure.

Yes I get that but I was trying to make the point that there's more to the relational model than just assurances. It offers a richly entwined semantic structure and an elegant route to reducing duplication and the risk on inconsistency that comes with it. None of this is in tension with dynamic typing.

(Also - dynamic languages aren't just for sloppy thinkers and cowboy coders. There's actual value that is lost in moving to static typing even if you think the trade-off is well worth it)