> From: "David Arno" <da...@davidarno.org>
> To quote Bertrand Meyer
> (http://drdobbs.com/184414874):
> 
> "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)."
> 
> I'm in full agreement with the above quote. I think it is good that AS3
> doesn't allow method overloading. Yet it is a popular request, so 
clearly
> other folk disagree with this. I'm therefore curious to know why people 
are
> requesting what ought - IMO - to be viewed as a bad thing.
> 
> David. 

David, I completely agree with you (and Bertrand Meyer). I seem to remember 
that a lot of writers on the subject of clean/efficient code say that 
overloading is basically an overly abused construct (a bit like the 
Singleton pattern) and that most cases where it is used, it should be 
replaced by different methods whose names are pretty clear on what they 
differ. Even with constructors, which is something most overloading 
advocates refer to, could be replaced by static factory methods with a 
clear naming strategy (createWithDistance, createWithDistanceAndSpeed, 
etc.).

I've been able to live without overloading in AS for ages and even if that 
was possible I doubt I'd ever use it or allow it to be used in my team. 
But, as David and Jeffry said, I wouldn't stand in the way of anyone 
wanting to implement something around that. Maybe someone can come up with 
a clever system that eases the task of the developer while keeping the code 
expressiveness to the final user. 

Best,
Rui

Reply via email to