News for hackers. Stuff that matters.
Re:Postgres for everything (e/Postgres) by RedShift1 on Saturday December 07, 2024 @03:13AM (#42348138)
What exactly is the problem with tight coupling? You're going to insert an entire layer that basically translates format A to format B, just so you can later change a column name in the database and not have to change it in the API or something?
Re:Postgres for everything (e/Postgres) by grey-area on Saturday December 07, 2024 @03:28AM (#42348205)
1. You don’t want or need to expose lots of implementation details. Many of your data structures should be private, and many should be partly private.

2. Your data structures should not dictate the shape of your api, usage patterns should (e.g. the user always needs records a,b,c together or they have a and want c but don’t care about b)

3. It stops you changing any implementation details later and/or means any change is definitely a breaking change for someone.

Re:Postgres for everything (e/Postgres) by vineyardmike on Saturday December 07, 2024 @03:28AM (#42348201)
Yes.

But actually, yes. Sometimes the format changes, sometimes you want to store an extra bit of data that should only be exposed internally. Sometimes you realize that storing a timestamp as a unix-time int no longer cuts it, and you have to migrate to an ISO 8601 time, or whatever, or you add a flag to your records for some A/B test feature, that is intentionally not going to last forever, and should only be internal.

You probably want that layer anyways, for things like AuthN/Z.

If you're going to publicly expose an API, it's got to be stable for a while - that's a commitment you're implicitly making. That's hard enough to maintain without now also committing to stability in your internal representation of data.

Re:Postgres for everything (e/Postgres) by hmottestad on Saturday December 07, 2024 @03:29AM (#42348210)
Normalization is one of those typical issues where you might be fine with having everything normalized when you start off, but then once performance gets bad you end up denormalizing tables that are typically joined.
Re:Postgres for everything (e/Postgres) by haileys on Saturday December 07, 2024 @03:22AM (#42348187)
Yes. A lot of the work I've done through my career is essentially this, once you boil away the rest of the details.
Re:Postgres for everything (e/Postgres) by Cthulhu_ on Saturday December 07, 2024 @04:23AM (#42348423)
There's a few issues; one is that if you have the DB do everything, all of your business logic lives there too, instead of just the data. This is still fine if you have a single use case, but what if in addition to your main application, you also need to use it for things like BI, customer service, analytics / predictions, etc? It then quickly becomes better to use it as a datastore and have another layer decide what to do with it.

And in 30 odd years, everything will be different again, but your company's main data store will not have moved as fast.

Re:Postgres for everything (e/Postgres) by pdimitar on Saturday December 07, 2024 @10:03AM (#42350213)
The extremely obvious problem is that how you store data is an implementation detail and those change when requirements (or the market) evolve. I'll give you an API and will make triple sure it's as fast as a machine can even serve it and you let me worry about how it's all stored.

To additionally answer you with an analogy: when you have a problem with a company, you call the call center, not Jenny from accounting in particular. Jenny might have helped you twice or thrice but she might leave the company next year and now you have no idea how to solve your problem. Have call centers to dispatch your requests wherever it's applicable in the given day and leave Jenny alone.

Re:Postgres for everything (e/Postgres) by halfcat on Thursday December 12, 2024 @02:33AM (#42397043)
> * What exactly is the problem with tight coupling?*

As Joel Spolsky put it: ”the cost of software is the cost of its coupling”.

More specifically the cost of making changes when “if I change this thing I have to change that thing”. But if there’s no attention paid to coupling, then it’s not just the two things you gave to change, but “if I change this thing I have to change those 40 things”.