Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is Method Overloading a good or bad thing?
Message
De
01/07/2004 17:57:53
 
 
À
01/07/2004 17:51:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00919869
Message ID:
00919900
Vues:
14
I'm with you on this. A constructor is really just a method. Imagine not being able to overload constructors... whew! Gives me the willies just to think about it.

Alan

>I'm not sure I agree with him. IMO, there are times when overloading makes lots of sense. Take any function in VFP that has optional parameters. Without overloading you have two choices:
>
>1. Have a separate function that you have to call depending on the number of parameters.
>2. Always pass all parameters.
>
>In these cases, overloading makes sense.
>
>
>>( Warning I may have just thrown a Hand Grenade. Question is did I remove the pin? <s> )
>>
>>I have limited experience with .Net but one concept that caught my eye was
>>the allowing of Method Overloading. That is more then one method that has
>>the same name in a class but differ by the parameters passed. VFP
>>'Handles' that situation by use of PCOUNT( )s and VarTypes, but I saw the
>>Method Overloading in .Net as much cleaner.
>>
>>Why I bring it up is that I was reading a article by an developer that I
>>respect Bertrand Meyer in which he states things like:
>>
>>"Overloading, the most masochistic device ever introduced, means that you
>>can give the same name to several methods as long as they differ by at least
>>one argument type. This is a rare example of a facility that has no known
>>advantage, and many documented problems (it's confusing, and conflicts with
>>object-oriented mechanisms such as polymorphism and redefinition) ....
>>
>>The support for overloading in the CLS is a design flaw. Even if it had any
>>conceptual justification, overloading would still be a language concept, and
>>one that concerns not the deeper semantic properties of a language, but the
>>external appearance of software texts-a mere facility for the program
>>writer. It has no place in a general OO model; even less in a scheme like
>>the CLS, whose very purpose is to enable many languages to collaborate.
>>
>>Overloading languages should never have been permitted to pollute the common
>>conceptual setup with a marginal mechanism that complicates everyone's job.
>>Instead, overloading should have been explicitly removed from the CLS,
>>putting the onus on the overloading languages to provide a demangling
>>algorithm to clean up any mangled names."
>>
>>Do others agree with what he is saying?
>>
>>See: http://www.sdmagazine.com/documents/s=7207/sdm0207f/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform