An interesting discussion arose today around the concept of having one method with flags versus two methods for each state of the flag. Which makes more sense and why?
void Submit(object data, bool isDraft);
or
void Submit(object data);
void SubmitAsDraft(object data);
I am tending toward the later, where each operation explicitly indicates what the transaction is performing.
Which makes more sense and are there well known rules or patterns that suggest why?
EDIT:
Assume the methods are being exposed as operations via a SOAP Service and OO concepts don’t necessarily apply. Although OO is the implementation behind the service.
I would do this:
But that’s just me…