Live data from Hacker News

DSLs are a waste of time

leebriggs.co.uk

11–20 of 165 posts

Re: DSLs are a waste of time

#11
Yes DSLs have been a terrible failure in the infrastructure space. But that's just because DSLs are suited to a class of problem where the language of the domain is well-defined and changes infrequently. What we've seen with devops is an ecosystem that changes even more rapidly than frontend software development (in other words, a brakeneck pace). DSLs are great in any area where you want to allow less-technical or untechnical users generate some simple rules. So think finance teams using Microsoft Excel, or video game story writers using in-house DSLs to define game events.

Re: DSLs are a waste of time

#12
post #9

Why don't we have a tool that lets us associate monetary budgets to concrete hardware specs, and then generates a cross-cloud (or cloud-agnostic) configuration? budget: $23000 pricing: cheapest cpu: preferred: xeon cores: 8 mem: 64gb disk: preferred: ssd And some --import-usage flag to specify a folder of historical CPU and memory usage from Grafana.

Found a great option for you at $23000. Amazingly we managed to accommodate your budget. /s

This is a nice reminder of the importance of having your software be a "user-agent"!

Re: DSLs are a waste of time

#13

Why don't we have a tool that lets us associate monetary budgets to concrete hardware specs, and then generates a cross-cloud (or cloud-agnostic) configuration? budget: $23000 pricing: cheapest cpu: preferred: xeon cores: 8 mem: 64gb disk: preferred: ssd And some --import-usage flag to specify a folder of historical CPU and memory usage from Grafana.

This is backwards. What you want is to specify resource limits and then have the maximum possible bill calculated for you.

If you want services to turn off if they exceed a threshold then you will need some sort of priority scheme.

Re: DSLs are a waste of time

#14
post #8
post #5

Earlier quoted context omitted.

DSLs need not be declarative. DSLs need not be succinct. DSLs need not be close to English at all. All of these are properties which may or may not apply to a _specific_ DSL, they are not defining features.

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

Why not?

Re: DSLs are a waste of time

#16

This is a great takeaway from the article-- "programming languages are the better authoring model for cloud infrastructure". I was surprised by the simplicity of the "complex" terraform example the author offered, I have seen much thornier Terraform. The title, while appropriate for an article inspired by Terraform, I think misses the benefits DSLs have paricularly in LISP-derived ecosystems. A much better title for…

I like DSLs for many things but not for building out cloud infrastructure. It seems like the whole point of those things to build layer of complexity on top of layer of complexity. If any if those things meant you didn’t need to know all the thorny details of bash scripting, charsets, quoting and all, they might be a met positive but as they don’t you might as well write some bash scripts.

Re: DSLs are a waste of time

#17
DSLs aren't a waste of time. But when you create a DSL, you limit the size of the community that will interact with it. So if you create a DSL, make sure that the benefit in expressiveness is worth the down-side of a smaller community.

Re: DSLs are a waste of time

#18
So, the author considers platform specification languages a waste of time, and has no idea what DSLs are (except that he knows about plartform specification languages)...

Yes, platform specification languages are a mess. Making them without the "language" part keeps all of the mess (the language is absolutely not the source of it). There are people trying to fix this, although I'm not sure if I'd place Pulumi on that group.

And DSLs are still a great software architecture technique with all kinds of applications.

Re: DSLs are a waste of time

#19
OC is arguing that Terraform is a suboptimal abstraction for infrastructure-as-code.

I have no dog in this fight. But I do have opinions about DSLs.

The declarative vs imperative, or some hybrid, debate is ongoing with build systems.

James Duncan Davidson, author of Ant build system for Java, famously wrote a post-mortem. Mostly wrt to choice of XML for Ant's syntax and semantics. TLDR: Wheels fall off a declarative model once imperative logic is added.

FWIW, Here's how I think about declarative DSLs. Such as a scenegraph.

You have an exquisite mental model for a scene. It's probably hierarchical.

You attempt to capture that mental model in code. The representation is probably a grove data structure. aka Directed Acyclic Graph where nodes can have key/value pairs for metadata.

You need to serialize that grove. So you pick a suitable syntax. Hopefully something that looks like VRML-97. Basically s-expressions (JSON without the syntactic vinegar), with some way to represent object prototyping (define/use), and don't forget identifiers ("id" field). Bonus points if you include path expressions in your syntax.

That (human readable) serialized grove is the declarative DSL.

In an future perfect world, your mental model, runtime representation, serialization format, AND the real world will be isomorphic.

Not isomorphic? Of course they're isomorphic. Why even mention it?

Funny you should ask.

In the Java world, dom4j for representing XML documents, and most of its progeny, is not isomorphic. Only JDOM2's class hierarchy design actually matches the serialization format. (As of the last time I checked, a few years ago.)

dom4j's mismatch, leaky abstraction, poor design, what have you, begat untold additional labor and heartache. Which is all completely mooted by JDOM2's correct design.

Ensuring correct isomorphism avoids errors in the same way that strong typing and garbage collection do.

To wrap this up...

In my experience, isomorphism is the exception.

I have no idea if Terraform is a good declarative DSL. But I do know that it should be isomorphic with the runtime representation AND the real world. And that should be settled before weaving in imperative functionality.

Re: DSLs are a waste of time

#20
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.”

Post reply on HN