Re: optional or interface



On 31 mei, 04:38, Mike <Sulfate...@xxxxxxxxx> wrote:
Hi

Very often, I need to modify the procedure to fit more extensible
purpose. Then I choose to add more optional arguments in the current
procedure. I don't like to write another similar procedure and use
interface, since there will be lots of similar procedures and then
hard to manage them.
However, it will be harder and harder to write more generic procedures
when demands are more general.
I'd like to ask how you decide which one (or any other one) to be
used.

Thank you in advance.

Mike

There is no crisp answer to that, but consider this:

If your routines are getting too complex, because they have too many
tasks (as indicated by the continual addition of optional arguments),
then it is time to break them up.

If you want a hard limit, then I'd say up at most two or three
optional
arguments are acceptable (unless the routine simply sets
configuration
options and does not do much processing, then it really does not
matter much). Beyond that, consider splitting up the routine, as
things
will get out of hand.

Regards,

Arjen
- I'd
.



Relevant Pages

  • Re: optional or interface
    ... purpose. ... interface, since there will be lots of similar procedures and then ... If you want a hard limit, then I'd say up at most two or three ... Beyond that, consider splitting up the routine, as ...
    (comp.lang.fortran)
  • lsqcurvefit-converge?
    ... I have a problem considering lsqcurvefit as a routine to fit a number ... residuals =0.016. ... and the warning messag ...
    (comp.soft-sys.matlab)
  • Re: input word
    ... a routine small enough to fit on a single CRT screen. ... They're a lot less blocky than most TFTs - and yes, ...
    (comp.lang.c)
  • Re: great
    ... > What's the purpose of adding the ATL object? ... Your C++ routine becomes a method call within a COM object. ... That is the whole purpose of using COM in the first place. ... Brian ...
    (microsoft.public.win32.programmer.ole)
  • Re: MATLAB Central Spring Contest
    ... is the routine that checks for forbidden ... More than once in past contests I have ... call in helper code that I copied from a function I wrote ... for another purpose. ...
    (comp.soft-sys.matlab)