Building Domain Specific Contexts using DSLs in Golang

DSLs are an amazing way to join ease and control of a Config and the extensibility/reusability of code. One such example is Terraform which is built on HCL. The Session shows building, testing, and distributing one such DSL to unify Metric alerting using datatypes and functions exposed via DSL.

Abstract

DSLs are an amazing way to join ease and control of a Config and the extensibility/reusability of code. One such example is Terraform which is built on HCL. The Session shows building, testing, and distributing one such DSL to unify Metric alerting using datatypes and functions exposed via DSL. DSL are common to almost all developer tools. They abstract the complexity of logic that developers need to repeat, and provide simple reusable functions to the consumer. At the same time, the datatypes, expressions, and statements can be limited and statically verified to prevent Latent Bugs that configuration languages have to suffer from.  In this session, I will take a small use case of building alerts against some queries a database. But rather than allow developers to send naked queries against my database, I would rather expose a DSL that transpiles the DSL to the appropriate queries to the data storage backend.  This has multiple advantages:  1.Developer doesn't have to worry about the underlying change in Implementation. It's like an API call, only as a system command.  2.We have tight control of what queries need to be executed really. This is done to have control over the performance of the queries sent to the datastore  3.Any complex set of inputs, do not have to be passed as long function / SDK arguments.  One such example is Terraform. It's a DSL that allows functions as well as some degree of expressions to wrap repeat tasks underneath.  The session's aim is to leave the audience with a framework and understanding of the ease of writing such DSLs. There is some code, some snippets and a use case to build a DSL for.  The job of the DSL doesn't end there, a good DSL nudges the developer to make less mistakes and catch as much as possible earlier. And occasionally add support for inbuilt more functions. The lifecycle of DSL is covered during the talk, accompanied with code samples.

Video

GoLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".


Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2024 GoLab | The international conference on Go in Florence-Design & devCantiere Creativo-Made withDatoCMS