Now imagine the wasted energy: * maintainance of IDE plugins that generate OOP builders * authors who write about OOP builders * user groups which teach devs about OOP builders * additional unit tests * sonar rules * style discussions ... time that could be invested better.
-
-
Prikaži ovu nitHvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
-
Note: Directly mutating an object is problematic because the object properties still may be undefined on the type level. The compiler does not know which property was set.pic.twitter.com/AfhTCctICG
Prikaži ovu nit - Još 1 odgovor
Novi razgovor -
-
-
Builders are
but the FP alternatives doesn’t always necessarily read as well (in case it worked). Being able to read/see what you’re specifying (without relying on an IDE or the comment above) has IMO a lot of value. Are there FP options that support this better? -
It isn't FP specific, but in TypeScript you get a great support by using * named parameters in the case of functions * type templates in the case of object literals The latter option is my preferred. You just (recursively) specify the shape of objects and assign JSON {}.
- Još 4 druga odgovora
Novi razgovor -
-
-
What about optional properties? I think that's the point where OOP Builders are better, or do I miss something?
-
I haven't used it in this manner, yet, but it is possible:pic.twitter.com/DB531V9tRr
- Još 4 druga odgovora
Novi razgovor -
-
-
This is not a builder pattern. This is a factory function with named parameters. What's up with OOP bashing? If you do not know how to use a tool effectively, do not blame the tool

-
I‘m afraid, it *is* a builder pattern, in the sense of > „The intent of the Builder design pattern is to separate the construction of a complex object from its representation.“ Source: https://en.m.wikipedia.org/wiki/Builder_pattern …
- Još 4 druga odgovora
Novi razgovor -
-
-
What's that editor that makes this ghosty syntax highlighting shine?
-
Hi Mark, it is the awesome Synthwave‘84 theme for VS Code. I love it :)
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.

Builder pattern: OOP
vs
Functional
You need named parameters? No problem!