Live data from Hacker News

Accidental database programming

sqlsync.dev

241–250 of 310 posts

Re: Accidental database programming

#241
post #102

There is an interaction here between the "what gets measured gets managed" principle and the sunk cost fallacy. The problem with databases is actually complexity. Any individual feature is more or less safe, but around the time reliability, caching and indexes get matched together there is a complexity explosion and it doesn't (normally, anyhow) make sense to implement a domain-specific DB (call is a DSD?). But, arou…

What is exactly hard about sql? Every dev imho should know it. And sql syntax is good and proven too be long lasting. Maybe investing some time in actually learning it instead of bashing it will help you further.

> What is exactly hard about sql?

- No non-nullable types (at the expression level). No way to express e.g. normal boolean logic

- No real data structures (at the expression level), unless you count rows, which are not first-class values. Even collections aren't first-class

- Very awkward control flow constructs. E.g. look at how you write recursive queries. Even if/else is weird. It's a classical Turing Tarpit: everything is possible but nothing is easy

- Absurdly complex grammar. Something like 200+ keywords. Bizarre and inconsistent quoting rules

- Weird rules about where expressions can be used, and where you have to put variables. Often if you want to extract out a common subexpression and reuse it you have to completely restructure your statement.

- Missing basic functionality, e.g. no string concatenation operator (except in some nonstandard dialects)

- No libraries. No standard way of reusing code. No unit testing framework, which means in practice most projects have no testing.

It's a terrible language by any reasonable standard. Its closest cousin is COBOL, and that's honestly less awful to write.

Re: Accidental database programming

#242
post #102

There is an interaction here between the "what gets measured gets managed" principle and the sunk cost fallacy. The problem with databases is actually complexity. Any individual feature is more or less safe, but around the time reliability, caching and indexes get matched together there is a complexity explosion and it doesn't (normally, anyhow) make sense to implement a domain-specific DB (call is a DSD?). But, arou…

Have you ever looked at adding a semantic layer on top of a db for those that prefer to avoid direct SQL?

You'd need databases that were open to splitting out and layering like that, and I don't think any major SQL databases are. (I mean, most SQL databases are still written in C-family languages; splitting out the PostgreSQL parser into its own library took 20 years and still hasn't really been done properly, they do some weird sync thing from the mainline postgresql codebase rather than being the actual trunk for parser development and having postgresql proper use it as a dependency). Maybe you could do something with H2?

Re: Accidental database programming

#244
post #130

Earlier quoted context omitted.

I can change A to B on my own, you can change A to C on your own. At some point we have to communicate which change is correct. It does not have to be synchronous and it might be via commit message - but still change alone is not enough for conflict resolution. If you edit word document and someone then changes something there is no commit message but might be comment on document, email or im.

Unison has a neat approach to this problem: References are hashes of the abstract syntax tree, the only way to write a "collision" is to write an identical function--which isn't actually a collision at all.

Good point. I do the same in my own system and use Hashes of the source code, so there are no collisions. Slowly this technique will become mainstream I predict.

Re: Accidental database programming

#245
post #199

Earlier quoted context omitted.

Yeah? It was targeted for destruction by Apple because it was buggy and insecure, not because it wasn't delivering.

Don't forget horrendous mobile performance (battery drain)!

Don't forget proprietary.

Re: Accidental database programming

#246

Interesting. How does server side validation and access control work with this?

Good questions! Validation can be handled in the reducer layer. Since the reducer logic re-runs on the server, it can do anything including reaching out to server-side resources like authorization or other dbs to ensure the client isn't doing anything fishy. It's also possible to use the full capabilities of SQLite to execute automatic in-db validation via triggers, constraints, checks, etc. Access control is more di…

Thanks for explaining!

Re: Accidental database programming

#247
post #124

Earlier quoted context omitted.

You say things like "X is pretty dumb" and then go on saying stuff I don't understand. Pretty annoying if you ask me. And that's despite me having worked with Cassandra, Kafka, Postgres and a variety of programming languages, DevOps tools, having worked with Vuejs and React.

Could you clarify which of: - page storage - reducers - replaying mutations - acks you're unclear on?

In that context, I don't understand the word reducer.

Re: Accidental database programming

#248
post #69

Earlier quoted context omitted.

But , if I can be honest, solutions such as Hotwire or Livewire are not as snappy as a SPA. I personally prefer InertiaJs [1], which is some kind of front-end router system with its state synced with the server in an "old style" fashion. [1] https://inertiajs.com

I don’t know what SPA’s you have the pleasure of using, but most SPA’s I’m subjected to are an exercise in molasses like interactions and loading spinners.

I agree, most SPA's are very poorly designed. But others work so well that you don't even notice it. Random examples: Gmail, Notion.

Re: Accidental database programming

#249
post #203

Earlier quoted context omitted.

Ohh can't wait for the inevitable next step of dropping the "web" part of web assembly and doing, ya know, native fat clients again.

I work with lean, business speculative software mostly. Which means not cross-platform native development is simply not economical to do. I generally need to be able to hit Windows, iOS, Android, and MacOS square on with one code base. A "native" electron or capacitor distribution system is a fine extension of a local-first web client. And an advantage of building fat clients generally is they lend themselves to such…

Why not Java?

Re: Accidental database programming

#250

Earlier quoted context omitted.

I don’t know what SPA’s you have the pleasure of using, but most SPA’s I’m subjected to are an exercise in molasses like interactions and loading spinners.

I agree, most SPA's are very poorly designed. But others work so well that you don't even notice it. Random examples: Gmail, Notion.

> Well designed > gmail

I too, enjoy satire.

Post reply on HN