Re: optional or interface



Arjen Markus 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.

Good advice.

My rule of thumb is to make procedures do one one thing, just one thing, and to do that one thing very well.

A search of my source code posts to this newsgroup will show that it is not always easy to do. :o)

cheers,

paulv
.



Relevant Pages

  • optional or interface
    ... I need to modify the procedure to fit more extensible ... purpose. ... it will be harder and harder to write more generic procedures ...
    (comp.lang.fortran)
  • Re: When the Hell.......................
    ... >>> provided were not fit for purpose. ... By supplying models and software not fit for purpose you fail ... I said I could render it 200 times faster than a high-end PC back in 1995 on a modern high-end PC. ...
    (rec.arts.drwho)
  • Re: When the Hell.......................
    ... implies that they met with your approval and *were* fit for purpose. ... By supplying models and software not fit for purpose you fail ... The purpose was to see if you could render in real-time as you'd ...
    (rec.arts.drwho)
  • Re: O2 dont seem to care about security! Paul Muttons little rant continues
    ... it is not fit for purpose Bob? ... I've not accused him of anything other than being an anonymous nutter who ... he might understand everything and just be a major troll - but ...
    (uk.telecom.broadband)
  • Re: Re: they are ranging such as the suburb now, wont urge blades later
    ... modify them? ... Where did Zebediah top the review to the inclined ... fit might send some inappropriate pans. ... emphasizing in conjunction with cautious, minus wrong, depending on ...
    (sci.crypt)