News for hackers. Stuff that matters.
Re:Post-Architecture: Premature Abstraction Is the Root of A... by epgui on Thursday July 18, 2024 @12:55PM (#40997507)
If you think OOP is particularly well-suited to domain modelling, you should try the FP approach to domain modelling.

You will never be able to unsee the complexity inherent to OOP.

Re:Post-Architecture: Premature Abstraction Is the Root of A... by jprete on Thursday July 18, 2024 @01:44PM (#40998036)
Do you happen to have a link to an example or explanation?
Re:Post-Architecture: Premature Abstraction Is the Root of A... by arendjr on Thursday July 18, 2024 @02:32PM (#40998432)
The keyword to search for is algebraic data types, which are common in functional languages, but for instance Rust also has them.

Here is an example comparing C# with F#, where the latter also algebraic data types: https://blog.ploeh.dk/2016/11/28/easy-domain-modelling-with-...

Re:Post-Architecture: Premature Abstraction Is the Root of A... by neonsunset on Thursday July 18, 2024 @02:54PM (#40998628)
The syntax has improved quite substantially since 2016 for pattern matching at C#'s end, and it's very easy to model ADTs with records (and the experience of using them even before that was decent with methods accepting lambdas).

Today, you write it in a similar way you would write a match in Rust.

Re:Post-Architecture: Premature Abstraction Is the Root of A... by nequo on Thursday July 18, 2024 @11:16PM (#41001776)
How do you represent sum types in C# today? Can enum members hold records as data, or do you do it differently?
Re:Post-Architecture: Premature Abstraction Is the Root of A... by epgui on Thursday July 18, 2024 @05:26PM (#40999924)
The other commenter is not technically wrong to point at “algebraic data types”, but I don’t think that answer is helpful at all. It’s like saying the answer to data modelling is tuples.

I would instead recommend searching for “functional programming and domain driven design”.

Re:Post-Architecture: Premature Abstraction Is the Root of A... by rapnie on Friday July 19, 2024 @12:03AM (#41001938)
Domain Modeling Made Functional [0] by Scott Wlaschin

[0] https://www.youtube.com/watch?v=2JB1_e5wZmU

Re:Post-Architecture: Premature Abstraction Is the Root of A... by brabel on Friday July 19, 2024 @02:21AM (#41002432)
You can try the FP approach today in most languages that are not even FP:

* Rust * Kotlin * Dart * Java

Yep, even Java. Check this out: https://blog.jdriven.com/2021/10/sealed-classes/