#builder Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Java Builder Pattern
For objects with many optional parameters, a Builder beats a constructor with 12 args (or a half-initialized object you have to call setters on). Method chaining + a `build()` step that validates.
Go strings.Builder — Efficient Concatenation
Building strings with `+` allocates O(n²) memory. `strings.Builder` writes to an internal buffer with a single final allocation — orders of magnitude faster in loops.
Rust Builder Pattern with Method Chaining
Construct complex objects step-by-step with `self`-returning methods. Type-state can enforce required vs. optional fields at compile time — but the simple version is plenty for most cases.
Kotlin Type-Safe Builder DSL
`@DslMarker` + lambdas with receivers let you build statically-typed DSLs that look like declarative configuration. The HTML / Gradle Kotlin DSL style.
Kotlin apply — Configure Object, Return Itself
`x.apply { ... }` runs the block with `x` as `this` (so you call methods/set properties directly) and returns `x`. The canonical builder-style configuration.