On Jan 2, 2012, at 3:08 PM, Krzysztof KosiĆski wrote:
Awesome analysis! Thanks a lot :)
As Johan said, it's better to add a parameter that controls the use of Coalesce, since this function is also used in the stroke-to-path functionality.
Sometimes it's good to have an optional parameter, but then again sometimes it helps to have a separate function with an explicitly different name (even if at the implementation they end up calling a shared common function with a parameter).
Personally I think it really comes down to which one will make the code that uses these easier to read. And I do dislike the name "item_outline()" as it seems somewhat vague. A name more like "createOutline()" or "createOutlineFrom()" might be a fair replacement.
Hmmm... and if one took "createOutline()" as a name, then a choice to provide two functions might end up with "createOutline()" and then a second method named something like "createOutlineCoalesced()" or "createCoalescedOutline()" could be chosen.
So Krzysztof, given all of that, do you think this is a case where
Geom::PathVector *newThing = item_outline_coalesced(myItem);
is best or is it one where we'd want
Geom::PathVector *newThing = item_outline(myItem, true);
for getting the best code legibility?
Oh, and there is always the consideration of not using plain data types for flags, but having an explicit enum instead. That variation would give us
Geom::PathVector *newThing = item_outline(myItem, COALESCE);