Ruby on Rails was very famous back then! Because Rails as the name suggest, offer high development speed. Using metaprogramming offered by Ruby, Rails help to reduce the amount of work to be done by generating boilerplates code on the fly.
So, to increase our development speed we need to find a way to reduce the amount of codes that needs to be wrote and replaced it with generated codes. Using Pareto principles that means we can reduced about 80% of the codes that needs to be written by hand.
My guess is we can use external DSL (Domain Specific Language) to help us in reducing our work. Let say we start by defining the grammar to define REST API. Something like this:
api * {
authorization using Api_Key in Header {
header_key: X-API-Key
}
authorization using Bearer_Token in Header
}
api get "/query" {
query_params {
igid: string[0..250]
adsad: int
}
response {
id?: string[1..250],
name?: string[1..255]
}
}
From that API definition we can generate:
- OpenAPI spec
- The backend codes (by adding more meta information)
- The front end sides SDK. From thata one definition we can generate codes for any kind of front-end platforms, e.g Flutter, Kotlin, Swift, etc
- We can even generate the relational table definitions (also by adding more meta information)
- The automated tests for testing the API
- Json Schemas, and many more!
From quick search on Google, Helium is one example of project who has the same kind of idea. Now, the challenge is to produce a DSL that is easy and convenient to use also reduced the boilerplates code to write the implementation by hand. ANTLR is one option that can help in writing the external DSL. Another option is XText and XTend from Eclipse Project.