796 reputation
46
bio website
location
age 42
visits member for 3 years, 8 months
seen Jul 10 at 14:16

Feb
18
awarded  Nice Answer
Feb
18
answered What have you learned from the bugs you helped discover and fix?
Feb
18
awarded  Supporter
Feb
18
answered Was Java originally designed for a toaster?
Feb
15
comment designing classes with similar goal but widely different decisional core
@Steven Jeuris: I completely agree on the indication of wrong abstraction, and I wouldn't choose this as a design. My answer is more focused on the "redesign" context, where my primary goal would be to make an existing design extensible without breaking anything or requiring large amounts of changes. I think we're basically agreeing on how this can/should be solved, but answer based on different primary goals.
Feb
15
comment designing classes with similar goal but widely different decisional core
@Steven Jeuris: On the topic of shared state, this is IMO an acceptable tradeoff, as it is both easy to detect when the expected state is not provided to the P4 class, and there's a single rarely changing point (the primary loop) where you need to ensure that the state is passed to PBase subclasses.
Feb
15
comment designing classes with similar goal but widely different decisional core
@Steven Jeuris:Making such functions pure virtual would require changing all PBase subclasses, which I'd want to avoid. Sure, for 4 concrete classes, who cares, but for a more complex scenario with e.g. a few hundred subclasses, avoiding changes to all classes due to the requirements of one new subclass would be preferable. The "Context" mechanism mentioned below and the method I describe allow changing requirements with minimum modification of existing code.
Feb
15
awarded  Teacher
Feb
15
answered designing classes with similar goal but widely different decisional core