this post was submitted on 02 Jul 2023
5 points (59.3% liked)

C Sharp

1532 readers
1 users here now

A community about the C# programming language

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

founded 1 year ago
MODERATORS
all 8 comments
sorted by: hot top controversial new old
[โ€“] JackbyDev 12 points 1 year ago

I shouldn't have to watch so far into a video to see what the topic actually is.

[โ€“] douglasg14b 8 points 1 year ago* (last edited 1 year ago) (1 children)

Isn't this an entire class of problems that's avoidable by using strict DDD-style entities?

You don't have the same "purists" OOP problems, you don't have extension methods to get lost in, you don't have publicly mutable state, and you have a clear surface area for state changes. And your ORM is happy.

Purists OOP has all sorts of issues, more procedural, pragmatic, approaches can alleviate that pain. And strict entities provide the same surface area as the functional approach, without concerns over breaking ORM tracking. With the added benefits of closely guarding local state.


Opinion time.

This is less "what you can't do in OOP" and more "what you can't do if you use OOP design as dogma" ๐Ÿค”. Perhaps that's an important distinction to make, depending on your viewership, but to me this feels like a solution looking for a contrived problem.

[โ€“] canpolat 3 points 1 year ago (1 children)

I agree that this is a solution looking for a problem. I still think the way he explores the limits of the language is food for thought. And the fact that this is at all possible makes C# a fun language to work with.

[โ€“] douglasg14b 1 points 1 year ago

Oh definitely. I have some gripes with C# as a language that I wish for better. But it's extremely flexible.

[โ€“] douglasg14b 5 points 1 year ago* (last edited 1 year ago)

Kind of sucks that the source is locked away...

Would be a lot more convenient to read it when I don't have the whereabouts to watch a video about it(env, data...etc).

Edit: Finally was able to get the whole thing to load, commented on my thoughts.

[โ€“] Fordiman 4 points 1 year ago

Creating new objects would confuse your ORM vs. Always create new objects? Well, you've convinced me.

If you just made copy constructors in the first example, the problem wouldn't have existed. This is wholly contrived, and I feel dumber for having watched it.

Not even saying I like OOP, or that functional isn't usually a better paradigm - but this was the goofiest argument I've seen for it.

[โ€“] canpolat 3 points 1 year ago

Video description:

In Object-Oriented Programming, objects are instances of classes and they encapsulate behavior and state - that is what every textbook on OOP is teaching. However, there's a subtle limitation in OOP when it comes to dealing with changes in the state of these objects. We often try to mitigate that limitation by applying the State design pattern, but that adds extra complexity and potential confusion to downstream components, especially when using Object-Relational Mappers (ORMs).

In this video, you will learn to recognize the fundamental limitation of Object-Oriented Programming and how Functional Programming (FP) offers an inverse perspective. Through immutability and transformations of values, FP tends to make state transitions explicit and predictable, leading to a more straightforward way of handling the issues that would otherwise be too large a burden for a corresponding object-oriented model. This requires a shift in thinking and can introduce its own challenges and learning curves. It is a fascinating topic, shedding light on the fundamental underpinnings of OOP and FP, and their practical implications in software development.