this post was submitted on 02 Jul 2023
2 points (100.0% liked)

Functional Programming

1389 readers
1 users here now

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] heartlessevil@lemmy.one 0 points 1 year ago (1 children)
[โ€“] bugsmith@programming.dev -1 points 1 year ago* (last edited 1 year ago)

I asked ChatGPT to summarize from the video transcript:

"In the video, the presenter discusses a challenge in object-oriented programming related to changing the runtime type of objects. Using the example of invoices in a bookstore application, they demonstrate how the State design pattern is commonly used to address this issue but comes with limitations. They introduce the functional programming approach as an alternative, emphasizing the creation of types rather than classes and the use of abstract records and extension methods. The functional programming approach simplifies the implementation, avoids the need to change runtime types, and offers advantages such as shorter code. The presenter encourages viewers to consider adopting functional programming principles, especially with the evolving nature of languages like C#."

I'm not entirerely sure I agree with his premise. I totally see the merits of functional programming (either pure or blended with traditional OOP), but I don't think his example really solves the ORM problem any better than if he'd not used a deliberately contrived OOP example intended to make make his point look better.