this post was submitted on 15 Nov 2024
157 points (100.0% liked)
Programmer Humor
853 readers
17 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yes, this ties in with what I'm saying though. You need a paradigm shift in your design philosophy, which is hard when you come from a Cx background.
I also think that in OO there shouldn't be much cross contamination. It happens (and it happens a lot in my personal projects to be fair) but when well designed it shouldn't need to be. In C# for example it should be the case that rather than a function owning a resource, a class should. So when using an object between classes you take it as a reference from a method in one class and pass it into a method to another class rather than call that class and make it a dependency of that class too. In this way you would have a one way dependency, rather than a two way.
This kind of thinking has moved into creating objects in rust. Also I think yes within a same class the idea of a function (that isn't static) accepting an object that is part of the class that was returned by another function in the case class feels very wrong from a Cx style point of view. If we knew we were going to do that, we'd just make it a class level variable and use it in both functions.
Like I say, just another way of thinking and I'm not there yet.