Closed pixelzoom closed 7 years ago
Passing initial values via options was not possible, since those values are computed based on other things (e.g. radius, binCount) initialized by Ball (supertype) constructor. I considered passing in functions to compute the initial values, but that got complicated and I ran into ordering/dependency issues. So I decided to resolve this issue by simply documenting that these fields are owned by the supertype, and explaining why their values are changed by the subtypes.
Closing.
In Histogram:
This function indicates that
ball
has type{IntroBall|LabBall}
, and it accessesball.binOrientation
.Problems:
(1)
LabBall
has nobinOrientation
field. So this is likely working only becausebinOrientation
is undefined and is getting coerced to0
. Add an assertion to verify.(2) If
ball
really is of type{IntroBall|LabBall}
, then it should be of type{Ball}
, since those are the only 2 subtypes ofBall
. And thebinOrientation
field should be part of theBall
subtype.In IntroBall:
... and in LabBall:
Problems:
(3) These 2 fields (
finalBinVerticalOffset
andfinalBinHorizontalOffset
) are owned by supertype Ball. They should therefore be initialized via options, so that initialization takes place once, in the supertype constructor.