anyone consider making some dsl wrapper for the bu...
# ballast
a
anyone consider making some dsl wrapper for the builders used in ballast? feels funny to see Builder patterns about when i would expect something more like
Copy code
config = viewModelConfig {
    withRouter(...)
}
just as an example
implementation beneath would just be something like
Copy code
fun viewModelConfig(block: BallastViewModelConfig.Builder.() -> Unit): BallastViewModelConfig {
    return BallastViewModelConfig.Builder().apply {
        block()
    }.build()
}
probs stating the obvious. id be happy to possibly contribute this myself as ive written a handful of these in the past, only im not familiar with ballast
c
I intentionally left it out of the core library, to keep the library size smaller and allow you to define your own DSL if you want it, but not require it if you don’t like it. DSLs have their place in building large, usually hierarchical objects, but the Ballast configuration is small and not hierarchical, so it didn’t make sense to add the DSL for this use-case. I tend to be of the opinion that I’d rather not have DSLs for everything, but start by using normal OOP mechanisms like classes and builders, and only add a DSL on top when it actually helps make the configuration clearer or significantly easier to use
a
thats fair!