ivapylibs / puzzle_solver

1 stars 2 forks source link

Question about setMeasurement function in template.py #9

Closed Uio96 closed 3 years ago

Uio96 commented 3 years ago

I am not sure about the difference between setMeasurement and setSource. In the setMeasurement note, it says passing along to the instance measurement of the puzzle piece. What does it mean? Is that still a puzzleTemplate instance?

https://github.com/ivapylibs/puzzle_solver/blob/master/puzzle/piece/template.py#L73

pv33 commented 3 years ago

@Uio96 Most likely it is vestigial from when I thought Measurement was a better name then either did not delete or left if there for the sub-classes to overload.

When two member functions appear to be similar, the default action should be to figure out which is the more "primitive" and makes sense for the class being coded, then think if the other would fit better in a sub-class.

If so, then it may exist for inheritance purposes but might be best put in the proper class.

Once you figure out which is more "primitive" and which belongs in a sub-class, have the sub-class method invoke the "primitive" method like a pass through. Later on it will be corrected as best fits.

Uio96 commented 3 years ago

Currently, assume setMeasurement is to load a template instance while setSource is to a puzzleTemplate instance. See 44f4a6cac53ad39ef2f563c655b64b7b1cf452b2