Better HN
topnewbestaskshowjobs
Log inSign up

taffer

1,019 karma · joined Feb 7, 2019 (7y ago) · 491 submissions

Submissions

comment 1y ago · link · parent

> It turned out to have a huge multiplying effect on productivity

In retrospect, I am highly sceptical that OOP has had any positive impact on productivity. Its popularity coincided with the advent of automatic memory management, the World Wide Web and relational databases, and later with dependency management tools such as Maven. It is much more likely that it is these factors that have improved productivity, rather than OOP.

comment 1y ago · link · parent

AFAIK relational algebra and relational calculus are based on FOL (first-order logic) which predicates atomic elements. For nested elements you would need HOL (higher-order logic) which is mathematically hard to optimize.

As FOL is as powerful as HOL but easier to optimise, it has become the basis for relational databases. The trade-off is that you have to normalise your data so that you can efficiently query and apply constraints to it.

But yes, just because your data at rest should be flat relations, that doesn't mean that the results of your queries need to be flat. I think querying a well-normalised database and returning nested JSON makes a lot of sense.

comment 1y ago · link · parent

There are many people defending relational databases, and rightly so, but I have never heard anyone defend the syntax of SQL. It's just that everyone standardised on it as the language of relational databases in the 1980s. Its inertia is hard to beat.

comment 1y ago · link · parent

> With a bit of client-side logic, it's easy to transform that into this [example here] without the need to use json as a middleman.

The result in your example looks exactly like JSON. Am I missing something?

Also, what is the point of avoiding JSON? Your client has to unmarshal the result either way.

comment 1y ago · link · parent

Putting business logic in the database: https://sive.rs/pg

Example code: https://github.com/sivers/store

This talk is more Oracle specific but with some minor changes you can apply the same ideas to postgres: https://www.youtube.com/watch?v=GZUgey3hwyI

Personally I am using an architecture similar to https://sive.rs/pg in my personal projects and I am very happy with it. It is important that you put data and procedures/views in different schemas so that you can use migrations for your data but automatically delete and recreate the procedures/views during deployment. Also use pgtap or something similar for testing.

comment 1y ago · link · parent

This is also the conclusion of the article. The author then shows an example of how to get hierarchical json out of your relational database.

comment 1y ago · link · parent

I don't know where you are from (I'm really curious though), but where I live there are more than two political parties and more than a few mega corporations to buy or rent from. You seem to have an extremely distorted idea of what live is like in "western countries".

comment 1y ago · link · parent

> One of the ironies of this kind of advice is that it's best for people who already have a lot of experience and have the judgement to apply it. For instance, how do you know what the "simplest thing" is?

I think the author kind of mentions this: "Figuring out the simplest solution requires considering many different approaches. In other words, it requires doing engineering."

comment 1y ago · link · parent

The university I studied at was in a brutalist building. I loved it and every time I see a brutalist building, it reminds me of my time there.

comment 1y ago · link · parent

Germany is the only Western European country with an Eastern European capital. As a result, Berlin was poorer than the rest of the country, but this is no longer the case. Since reunification, Berlin has had the fastest growing economy in Germany and is now close to Hesse in terms of GDP per capita.

comment 1y ago · link · parent

In practice, it is even less. Current state-of-the-art algorithms compress the English Wikipedia using just 0.8 bits per character: https://www.mattmahoney.net/dc/text.html

comment 1y ago · link · parent

> I.e., The string "I'v_" provides way more context than "con_" because you're much more likely to get I'm typing "I've" instead of "contraception"

Yes the entropy of the next letter always depends on the context. One bit per letter is just an average for all kinds of contexts.

> Also the fact that there are more than two letters also indicate more than one bit

Our alphabet is simply not the most efficient way of encoding information. It takes about 5 bits to encode 26 letters, space, comma and period. Even simple algorithms like Huffman or LZ77 only require just 3 bits per letter. Current state-of-the-art algorithms compress the English Wikipedia using a mere 0.8 bits per character: https://www.mattmahoney.net/dc/text.html

comment 1y ago · link · parent

Have you had a look at the bytea[1] type? It allows you to store binary objects up to 1GB and it's dumped transparently just like a string.

[1] https://www.postgresql.org/docs/current/datatype-binary.html

comment 2y ago · link · parent

Here are some articles from 2022 and 2023. Btrfs database performance is still a disaster.

[1] https://www.enterprisedb.com/blog/postgres-vs-file-systems-p...

[2] https://www.phoronix.com/review/bcachefs-benchmarks-linux67

comment 2y ago · link · parent

That's poor advice. Use a database with checksums enabled like DB2, Oracle, Postgres, SQL Server or SQLite with the Checksum VFS Shim. TFA recommends the latter for good reason.

Running a database on ZFS results in reduced throughput, while Btrfs and Bcachefs are outright performance disasters. [1][2]

[1] https://www.enterprisedb.com/blog/postgres-vs-file-systems-p...

[2] https://www.phoronix.com/review/bcachefs-benchmarks-linux67

comment 2y ago · link · parent

The most commonly used filesystems on Linux, etx4 and XFS don't do checksums.

comment 2y ago · link · parent

Db2, Oracle, Postgres and SQL Server do checksums.

comment 2y ago · link · parent

Yes, otherwise for ticket owners who are not sure if they will make it to the concert, waiting until the last minute to request a refund becomes a dominant strategy.

comment 2y ago · link · parent

According to a study by the HTW Berlin, Germany collects €50 billion in road taxes and duties, but spends €30 billion on road maintenance and €30 billion on traffic police and road accident victims. Add to this an estimated €10-30 billion in environmental damage due to air and noise pollution.

comment 2y ago · link · parent

The EU should create a standardised system for tickets in Europe, similar to the New Distribution Capability for flights or SEPA for payments.

There should also be a unified system for passengers to claim their money back if their train is delayed.

comment 2y ago · link · parent

I couldn't disagree more. You can say a lot of bad things about Deutsche Bahn, but of all the travel apps I have used, DB Navigator and bahn.de were the best.

SNCF Connect, on the other hand, not only had a terrible UX, but also crashed randomly, forcing me to use third-party apps to buy SNCF tickets.

comment 2y ago · link · parent

> it's precisely because he was the pioneer, things like Java, microservices, json, APIs, have evolved from Kay's ideas.

Not to mention Excel, which uses cells, a concept invented by Alan Kay. He also invented OOP which in 1964 inspired the creation of Simula, the first OOP-Language.

comment 2y ago · link · parent

> I wish I could buy back my own mortgage at a discount given how much interest rates have risen

But why would you want to do that? If you take out a fixed-rate loan and interest rates rise, you are already making a profit. Financially, there would be no further benefit from the buy-back of the loan.

comment 2y ago · link · parent

As a counterexample, Azure Cosmos or Amazon DynamoDb are marketed as specific solutions for specific problems. Other RDBMS like SqlServer or Postgres are marketed as general purpose solutions because they are in fact general purpose solutions. Mongodb, on the other hand, is a specialized "document database" marketed as a replacement for relational databases.

comment 2y ago · link · parent

So what is a good use case for Mongodb? I have never seen an application where a "document database" would have been a good choice. In every project where I have seen Mongodb, it has turned out to be the wrong choice.

Even for prototyping there are many other good choices since RDBMS like Postgres have implemented JSON support. Mongodb looks like a solution in search of a problem.

comment 2y ago · link · parent

Postgres really took off when Heroku became popular in the late 00s.

comment 2y ago · link · parent

Why Fly.io if you want to build a monolith? Compared to Heroku or Render, to me Fly.io seems to be more aimed at edge computing.

comment 2y ago · link · parent

I have no idea what you want to say. Is this what you mean when you talk about riding the personal responsibility bicycle, only this time it is the jargon bicycle?

comment 2y ago · link · parent

> difficult to cancel subscriptions should not be allowed

In the European Union, you can cancel any subscription by email.

comment 2y ago · link · parent

In the European Union, you can cancel any subscription by email. There is no need to make a phone call or visit a scummy website.
12345
17