Hacker News new | ask | show | jobs
by LordHeini 1302 days ago
I disagree and would say DSLs should go away if possible.

DSLs like SQL are the norm and you can see the problem of them in basically every project.

You either use ORMs or you end up hand rolling SQL rows into Structs or Classes.

The whole mapping usually looks like crap and contains a bunch of implicit corner cases, which eventually end up being a footgun for someone.

Usually the SQL sever runs somewhere else, the ports are wrong, the language version is wrong, or a migration failed and a function is missing yada yada....

The same is usually true for Regexp. There are a billion dialects and every single one of them is basically unreadable, incomplete or just weird.

The same is true for microservices with tons of config files for dev, staging, testing and production...

Everything has its own version, can be down or mutate some random state somewhere while depending one other servcies.

It always breaks at the seams.

Increasing the amount of DSLs increases the amount of seams and thus makes software worse.

2 comments

But your ORM example could be considered a DSL in itself, so it doesn't really work that well. ORMs can be implemented in various ways too, as a syntactically looking different DSL or as something like objects and method calls or whatever the language already provides.

Regexes can be abstracted from exactly by making a more readable DSL.

Config files and the stuff accepted therein are small languages as well.

What are the alternatives to making little languages?

> DSLs like SQL are the norm and you can see the problem of them in basically every project.

I think your points re: sql are true of straightforward crud apps, but not true at all of an analytics app. In those cases, the sql is often _very_ complex, and while the results of a query may be eventually mapped into a struct or something, the query generation is rarely a simple mapping of properties in an object to select columns.

> There are a billion dialects and every single one of them is basically unreadable, incomplete or just weird.

Sure, but in the vast majority of cases, one only has to deal with at most 3 dialects, and there's a good chance you won't be hitting the corner cases that make each dialect significantly different.