PROCEDURE CallMe( tcPhone, tcName ) * NOTE: tcPhone is required, tcName is optional IF PCOUNT() < 2 tcName = "" ENDIF MESSAGEBOX( "Calling " + IIF( EMPTY( m.tcName ), "", m.tcName + " at " ) + m.tcPhone ) RETURN DialPhoneNumber( m.tcPhone)With overloads (if VFP allowed them):
PROCEDURE CallMe( tcPhone ) * NOTE: This overload accepts the phone # only and calls the full-signature overload with a default value for name. RETURN CallMe( m.tcPhone, "" ) PROCEDURE CallMe( tcPhone, tcName ) * NOTE: This overload accepts both phone # and name -- it is the full-signature overload. MESSAGEBOX( "Calling " + IIF( EMPTY( m.tcName ), "", m.tcName + " at " ) + m.tcPhone ) RETURN DialPhoneNumber( m.tcPhone)Clearly, best practices need to be applied, as in the use of any other programming language feature. OTTOMH, in this case I'd say (1) place overloaded methods together in source code, (2) indicate in comments that the method is an overload (3) put only overload-specific code in each overload and (4) delegate the main logic to the full-signature overload (my term, AFAIK). If any overload contains more than a few lines of overload-specific code, it would appear to me to be a candidate for a separate method (i.e., not an overload of some other method).