Remix.run Logo
DeathArrow 4 hours ago

I 100% agree. And even though I use C# which is kind of OOP heavy, I use inheritance and encapsulation as least as possible. I try to use o more functional worklflow, with data separated from functions/methods. I keep data in immutable Records and use methods/functions to transform it, trying to isolate side effects and minimize keeping state.

It's a much pleasurable and easier way to work, for me at least.

Trying to follow the flow through gazillion of objects with state changing everywhere is a nightmare and I rather not return to that.

mrsmrtss 13 minutes ago | parent [-]

I agree that changing object state and having side effects should be avoided, but you can achieve both immutability and encapsulation very easily with C#:

    public record Thing()
    {
      private string _state = "Initial";
      public Thing Change() => this with { _state = "Changed" };
    }