Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
4
Newest
 Editor
Impact
~257 people reached

  • 0 posts edited
  • 0 helpful flags
  • 6 votes cast
Apr
8
awarded  Editor
Aug
18
comment Is there a way to avoid type-checking in this scenario?
Sure, there are always trade-offs to consider (is this a one-off script vs. a enterprise application? etc.). The question/context so far is based on how to do this in an OOP appropriate way, which I still submit is not the right way to go about it if you're trying to stick to the tenets of OOP. Your last line could be argued for just about anything :). Hopefully OP chimes in with something a bit more concrete.
Aug
18
comment Is there a way to avoid type-checking in this scenario?
I disagree. That was only one example of why the code could become tricky to maintain. Once you start splitting functionality on Type in multiple ways, you completely lose the ability to let the Types/Interfaces speak for themselves and you end up leaving consumers to guess at how they are used because no contract exists.
Aug
18
awarded  Teacher
Aug
18
answered Is there a way to avoid type-checking in this scenario?
May
3
awarded  Supporter
Feb
8
awarded  Student