Skip to main content
26 events
when toggle format what by license comment
Aug 23 at 21:30 comment added Filip Milovanović @Basilevs if a new method is made to accept as an argument an object that it doesn't need with an inappropriate interface form another area of the domain, then it's not well-designed. But you're right, I'm not arguing your central point, I was just making a comment about your phrasing - the abstraction that has leaked in (as you say) is better framed or viewed as a detail that you, the designer, are leaking from your own class/abstraction. It doesn't matter that the detail in question is itself an abstraction in some other context; emphasizing that kind of focuses on the wrong thing.
Aug 18 at 10:32 comment added Basilevs @FilipMilovanović You are hyperfocused on abstractions that are "leaking out". When an method accepts as an argument an object that it does not need, with an interface from another area of domain, that object is an abstraction that "leaked in" the method. The object may be well designed, but the component that uses it overextended its dependency and no amount of protection by object designer could prevent that.
Aug 18 at 3:15 comment added Filip Milovanović @Basilevs - abstractions (be it custom types, conventions, higher-level functions, polymorphic abstract classes, interfaces, etc.) are what we work with and what we make with the intent to expose within a certain context. I'm just saying that phrases like "you leak abstractions" and "abstraction leak" don't make much sense. What you leak is the stuff you didn't intend to expose or represent with your abstraction. Thus, the abstraction in question is "leaky" (and is leaking what are considered unabstracted details within that particular context - otherwise there wouldn't be a problem).
Aug 17 at 5:59 comment added Basilevs @FilipMilovanović How is abstraction leak different from poorly maintained abstraction? How is passing an object of unrelated domain in a method is not an abstraction leak? I find your comment of abstraction leak bogus.
Aug 17 at 4:28 comment added Filip Milovanović 'violating the principle of "preserve whole object" - this is not a principle. It's a refactoring you can choose to do, or not. It all depends on the circumstances, and on what you're trying to achieve. Sometimes it makes sense to do it. Sometimes it makes sense to have it accept a completely different object that you can convert both Student and Teacher to (although in some languages, this conversion might not be necessary). Sometimes it makes sense to pass in a base class, a common ancestor to both types, relying on polymorphism. Sometimes it makes sense to keep the parameters as primitives.
Aug 17 at 4:21 comment added Filip Milovanović @Basilevs - one does not "leak abstractions", one makes "abstractions" that are leaky, there's a difference. I.e., they aren't designed and maintained with enough thought and are leaking details.
Aug 16 at 18:10 comment added Basilevs I have a strong opinion against "Preserve whole object". I often see objects being passed around leaking abstractions all over the place. I'm so traumatized by this, that I can't even force myself to find arguments for this refactoring.
Aug 16 at 15:30 comment added Doc Brown I believe the fact is, "Pass required parameters only" is often considered as a code smell waiting to be refactored to "Preserve whole object" - I think this is the root cause of this problem - you believe this, but your believe is certainly wrong. Note the opposite would also be wrong. It makes IMHO no sense to rate "Preserve whole object" vs. "Pass required parameters only" out of the context of a real program and real requirements. None of them is "better" or more "smelly" than the other, and I have no idea why you think it is.
Aug 16 at 2:58 history edited wcminipgasker2023 CC BY-SA 4.0
added 1 character in body; edited tags
Aug 16 at 0:33 answer added Flater timeline score: 3
Aug 15 at 23:43 comment added Flater showInfo(Student student) is a method whose job it is to display student information (regardless of which of the student's fields will be displayed). showInfo(String name, int age) is a method whose job it is to display a name and age (regardless of where these values were sourced from). These are two completely different responsibilities and they cannot be judged on syntax alone, like you're trying to do in this question. You need to consider the purpose, use cases and intended lifecycle of the method. All of that is missing from your question, making that part unanswerable.
Aug 15 at 15:49 history became hot network question
Aug 15 at 10:46 answer added sfiss timeline score: 0
Aug 15 at 9:40 answer added Basilevs timeline score: 2
Aug 15 at 9:31 history edited wcminipgasker2023 CC BY-SA 4.0
added 21 characters in body
Aug 15 at 9:21 history edited wcminipgasker2023 CC BY-SA 4.0
added 12 characters in body
Aug 15 at 9:15 history edited wcminipgasker2023 CC BY-SA 4.0
added 12 characters in body
Aug 15 at 9:06 history edited wcminipgasker2023 CC BY-SA 4.0
deleted 5 characters in body
Aug 15 at 8:48 history edited wcminipgasker2023 CC BY-SA 4.0
added 165 characters in body
Aug 15 at 8:39 history edited wcminipgasker2023 CC BY-SA 4.0
added 165 characters in body
Aug 15 at 8:09 history edited wcminipgasker2023 CC BY-SA 4.0
added 12 characters in body
Aug 15 at 7:51 answer added Ben Cottrell timeline score: 0
Aug 15 at 7:51 history edited wcminipgasker2023 CC BY-SA 4.0
added 90 characters in body
Aug 15 at 7:36 history edited wcminipgasker2023 CC BY-SA 4.0
added 172 characters in body
Aug 15 at 7:30 history edited wcminipgasker2023 CC BY-SA 4.0
added 4 characters in body
Aug 15 at 7:24 history asked wcminipgasker2023 CC BY-SA 4.0