Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Builder Pattern: Fluent Builders, WebApplicationBuilder and Where Object Initializers and required Fall Short
required, init and object initializers make a many-parameter constructor readable, but they do not solve cross-field rules, step order or an immutable result that accumulates piece by piece; Builder enforces those rules at a single Build() moment. How with skips a record's rule, the GoF Builder with a director versus the fluent builder, UriBuilder, connection string builders, the ImmutableArray builder, HostApplicationBuilder and the step builder, with real output.
C# record and record struct: Value Equality and the with Expression
The members the compiler generates for a record, copying with with, positional and nominal records, EqualityContract in inheritance, C# 10's record struct, and when to pick a record.
JavaScript Object Protection and Immutability: Property Descriptors, seal and freeze
We look at property descriptors, the sneaky defaults of Object.defineProperty, the difference between preventExtensions, seal and freeze, shallow versus deep freezing, and patterns for updating objects without mutating them.