News for hackers. Stuff that matters.
Re:Databases are the endgame for data-oriented design by nightpool on Wednesday December 06, 2023 @03:06PM (#38548818)
Most other programming languages are more composable than a SQL query. You can make functions, split logic into different classes, extract common logic, etc. Much harder with big sql queries
Re:Databases are the endgame for data-oriented design by camgunz on Wednesday December 06, 2023 @03:56PM (#38549348)
You can define functions in all major databases
Re:Databases are the endgame for data-oriented design by manicennui on Wednesday December 06, 2023 @04:22PM (#38549644)
And how many non-technical users do you know who do this?
Re:Databases are the endgame for data-oriented design by ako on Wednesday December 06, 2023 @04:46PM (#38549958)
And how many non-technical users do you know that write good javascript/java/.net/etc code?
Re:Databases are the endgame for data-oriented design by camgunz on Thursday December 07, 2023 @04:19AM (#38554481)
I think SWEs think of databases only as a kind of generic persistence layer and aren't super interested in a lot of the details (more than one has said to me databases are just an implementation detail) or additional capabilities, which I think is a very limited view. Databases are essentially interpreters, just like Python or Ruby. They come with access to a multiuser persistence (etc) service or engine (super handy!) but offer all the affordances of other interpreters. In fact, plpython on PostgreSQL will just use the Python packages on your system.

Do you have to read about it? Sure, just like all programming languages and platforms. But, interestingly, SQL was designed for non-technical analysts, so (to your point) it's more accessible than those others.

Re:Databases are the endgame for data-oriented design by ttfkam on Thursday December 07, 2023 @08:38PM (#38564325)
Mediocre coders fixate on algorithms. Great coders concentrate on data structures.

SQL schema creation and maintenance is all about choosing the right data structures for the job at hand.

If you neglect attention to your data structures, no algorithms will save you, and you really only have yourself to blame. It's a still to be learned and honed like any other.

Re:Databases are the endgame for data-oriented design by ako on Wednesday December 06, 2023 @03:32PM (#38549093)
Use views and stored procedures if you need composability.
Re:Databases are the endgame for data-oriented design by FridgeSeal on Wednesday December 06, 2023 @03:48PM (#38549280)
Counterpoint: don’t do this. The path to hell is paved with good intentions.

Some co-workers and I inherited a code-base where the authors went down the views and stored procedures route. It was basicallly impossible to untangle; there was no knowing what relied on a view or a proc, so you couldn’t touch them at all, there were no docs, there were duplicates of everything (and again, no way to know what’s used). A good number of them had all kinds of side effects and weird performance characteristics. They weren’t version controlled.

The issues just kept going.

Re:Databases are the endgame for data-oriented design by whstl on Wednesday December 06, 2023 @04:19PM (#38549606)
If your colleagues are not applying basic engineering rules to views and stored procedures, it's not fair to say that this is a problem with views and sprocs.

They can and should most definitely be testable, documentable, trackable and version controlled.

Should one also judge all backend programming by PHP standards circa 1998?

Re:Databases are the endgame for data-oriented design by FridgeSeal on Wednesday December 06, 2023 @04:24PM (#38549664)
I tend to judge things by the average-worst-case that they enable and how easily things go wrong, and IME stored procs specifically, go badly real quick.
Re:Databases are the endgame for data-oriented design by ttfkam on Thursday December 07, 2023 @08:42PM (#38564360)
Data structures can be a hard part of programming. That doesn't mean folks don't chose the wrong data structures all the time in any language.

An array instead of a linked list or vice versa. A dequeue instead of a set or vice versa. A binary tree instead of a B+ tree. You can't just throw column names at a DB schema and hope for the best. There's actual engineering to be done, even if many programmers refuse to admit it when interacting with a relational database engine.

Re:Databases are the endgame for data-oriented design by ako on Wednesday December 06, 2023 @04:24PM (#38549668)
You're blaming the language for the bad coding practices of the developers. You can build maintainable database code, and modern SQL IDEs like Datagrip provide similar tools for SQL like you have for other languages, e.g., refactoring, dependency/usage info, versioning, etc. The downsides you mention are not inherent to SQL.