Live data from Hacker News

DSLs are a waste of time

leebriggs.co.uk

31–40 of 165 posts

Re: DSLs are a waste of time

#31
post #14
post #8

Earlier quoted context omitted.

But they can be. They can have nice properties that general purpose languages cannot.

Why not?

Well the reasons for each point are a bit different so let's go through them one by one.

A declarative language cannot be general purpose by definition.

Succinctness. If you know exactly the domain you are talking about it means you can use many shortcuts and abbreviations that would be unclear otherwise. We all know this is true for natural languages, and it is also true for programming.

Close to English. In this case the reasons are more about aesthetics. English is not particularly good for general purpose computation as it struggles to express complex ideas with enough precision that it is crystal clear what is meant. A reader must apply some common sense to disambiguate. A general purpose language close to English would either be a Turing tarpit, or it would be a close-to-english language with some general purpose computation things bolted on.

Re: DSLs are a waste of time

#32
post #6
post #4

I think calling terraform a DSL in comparison to general purpose programming languages misses the point. If it used a declarative GPPL instead of HCL I wouldn't care, but imperative alternatives general purpose or not are 'a waste of time' & not fit for the domain, IMO.

CDK for Prolog would be quite the trip. As it turns out, what matters is whether the model is declarative. As some uses of YAML go to show, declarative vs not is an orthogonal axis to how general purpose or otherwise a language is, and orthogonal again to whether it looks like a configuration file or code.

I could see a prolog based solution being quite powerful if used to its advantage.

Someone would say…why not hold your state in SQLite and make it queryable that way? And it would be fair. But nowhere near as exciting a problem.

Re: DSLs are a waste of time

#33
post #28

We stop calling the useful ones “DSLs” so this is a truism. Is SQL a “waste of time?” Regular expressions, HTML, Makefiles, CSS (and CSS selectors aka jquery selectors)? It’s the bad ones that are a waste of time. The ones still called “dsl” instead of just “language, “format,” or “syntax.”

SQL would be my #1 example too. It is probably the ultimate DSL if you are willing to get deviant with your tech stack.

Sure. But you can create a declarative DSL without having to copy SQL.

Re: DSLs are a waste of time

#34
I feel like I get the author's points pretty well. I had in fact chosen Terraform when it was newer as a greenfield project to deploy our infrastructure more quickly at another company. And I was happy to find out my current company had built all their infrastructure with Terraform, since by that point I knew it really well. But I still struggle with interacting with it, expanding it, and trying to get it to sing to me.

The example given is pretty good at demonstrating how Terraform itself has some unique problems that they themselves created: using counts for enabling/disabling resources, using locals as proxies for data comprehension, writing long-ass resource descriptions, often with built-in functions and ternaries to get it to do what you want in various scenarios. Trying to be DRY in Terraform can often be a chore. I think Terraform's MO is actually that some duplicate code isn't the worst thing, so you end up with piles of duplicate lines that are extremely difficult to read, and where writing a function would be super helpful. We had an engineer do a bunch of Terragrunt work for a project and I found that code nigh-incomprehensible.

So, I get it as well, I get where they're coming from.

I also think working with DSLs isn't a huge waste of time, since many of the things we work on are abstractions of abstractions. It seems like everything I'm doing today is probably going to go away in due time, but I know how to program, read docs, and pivot quickly. I do feel like as long as you're gaining an understanding of the underlying elements, your time spent in a DSL (assuming you're getting paid or you end up using it for several years), is still well spent.

They mention Puppet, and I remember getting a job offer once because I was able to read the Puppet documentation and write out a little script that could do the ask in Puppet, even though I had never used it in a professional capacity before. It was easy to pick up and I would've happily worked in it if I accepted the offer. The knowledge I gain around deploying to AWS or other cloud providers is often transferrable in that manner too.

The clouds themselves are a sort of DSL often, but I can't say that my time spent with Azure was a waste just because I'm working in AWS now. No, we delivered stuff on that platform, I learned its pros and cons, I gained some wider understanding of what cloud platforms could do, and I got paid along the way :)

Re: DSLs are a waste of time

#35
post #7
post #4

I think calling terraform a DSL in comparison to general purpose programming languages misses the point. If it used a declarative GPPL instead of HCL I wouldn't care, but imperative alternatives general purpose or not are 'a waste of time' & not fit for the domain, IMO.

Pulumi is an example that proves the exception: using a general purpose language, you create a declaration of desired state. Think of it like if you used a GPPL to emit HCL. You get the power of that language: loops, function calls, unit tests, or even the ability to call external APIs. You're declaraing desired state and letting the framework sort it outb which is you say you aren't writing imperative code like: if…

Sure. But some people don't want to do that.

Re: DSLs are a waste of time

#36
post #7

Earlier quoted context omitted.

Pulumi is an example that proves the exception: using a general purpose language, you create a declaration of desired state. Think of it like if you used a GPPL to emit HCL. You get the power of that language: loops, function calls, unit tests, or even the ability to call external APIs. You're declaraing desired state and letting the framework sort it outb which is you say you aren't writing imperative code like: if…

That’s the key. Declarative converging systems so much better than imperative and all the edge case handling necessary.

Sure. But some people don't want to do that.

Re: DSLs are a waste of time

#37
> I was left with an expertise and knowledge of a language that was now, effectively useless.

VB did that to me; the lesson I learned is to avoid[0] languages with just a single implementation. As a consequence, I'm not very interested in languages like Ruby, Go and Rust. In the old days, every language had a train of compilers/interpreters following it. Pascal, COBOL, FORTRAN, even ALGOL. I believe that in those days, building a compiler for an existing language was a pretty standard hobby project. Everyone and his dog had built one, and manufacturers bundled their own ones with the hardware.

[0] Learning is hard; I jumped from VB to PHP.

Re: DSLs are a waste of time

#38
This is mainly a complaint about over abstraction and intrinsic complexity.

Tools like terraform offer simple modules to make your devops life easy.

But simple looking modules abstract a complex thing by hiding details. Details which are critical once your infrastructure reaches a critical complexity threshold.

At this point the tool is a burden. It is actively getting in your way to understand and get at the the actual infrastructure you are maintaining.

This is why imo alternative like CDK got popular. It doesn’t try to over abstract for you. It just gives you an api you write custom code over. The complexity of your code goes up with the intrinsic complex of the infrastructure.

Re: DSLs are a waste of time

#39

We stop calling the useful ones “DSLs” so this is a truism. Is SQL a “waste of time?” Regular expressions, HTML, Makefiles, CSS (and CSS selectors aka jquery selectors)? It’s the bad ones that are a waste of time. The ones still called “dsl” instead of just “language, “format,” or “syntax.”

It's like (speaking) languages really. The good ones are ones that have always been there and people have just sort of accepted into the mainstream (like English). Don't invent your own language. If you can do it in an existing language, don't invent your own.

SQL and CSS selectors fit the bill. Everyone has just kind of accepted them now. It's not an excuse to try creating new languages for every new thing, it's an uphill task.

Re: DSLs are a waste of time

#40

Earlier quoted context omitted.

That’s the key. Declarative converging systems so much better than imperative and all the edge case handling necessary.

Sure. But some people don't want to do that.

Some people like to overcomplicate things but that's not a reason to care.
Post reply on HN