Re: optional or interface



On May 31, 7:53 pm, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:
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
Thank you for your suggestion.

Mike
.



Relevant Pages

  • Re: optional or interface
    ... I need to modify the procedure to fit more extensible ... purpose. ... 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)
  • Re: Access MDI child properties generically
    ... wouldn't having your child forms implement an Interface ... I have a generic routine to create the TreeView and add it to a form since ... I also would like to add event handlers ...
    (microsoft.public.dotnet.languages.vb)
  • Re: optional routine arguments
    ... Anyhow that ifort was great for speed and support to f77 legacy code. ... Well, I knew of INTENT, INTERFACE and MODULE, and they were in the list among the next cans-of-worms to be opened. ... Actually there are cases in which I would not want even type checking (I have for instance a legacy routine which does byteswapping for both a REAL*4 and INTEGER*4, and another lot of telemetry handling routines relying on EQUIVALENCE ....) ... Write' 1st arg ',i ...
    (comp.lang.fortran)
  • Re: ChannelFactory
    ... das Interface an meine Routine übergeben und er bekommt ein gültiges ... If ServiceInterface.ToString.ToUpper = app.ServiceInterface.ToUpper Then ... End Function ...
    (microsoft.public.de.german.entwickler.dotnet.framework)
  • WCF : ChannelFactory
    ... Interface an meine Routine übergeben und er bekommt ein gültiges Objekt ... Channel erzeugen und mri das "Objekt" zurückgeben. ... End Function ...
    (microsoft.public.de.german.entwickler.dotnet.framework)