Should we rename overloaded methods?
Posted
by
Mik378
on Programmers
See other posts from Programmers
or by Mik378
Published on 2012-01-29T15:08:36Z
Indexed on
2013/10/29
16:12 UTC
Read the original article
Hit count: 521
Assume an interface containing these methods :
Car find(long id);
List<Car> find(String model);
Is it better to rename them like this?
Car findById(long id);
List findByModel(String model);
Indeed, any developer who use this API won't need to look at the interface for knowing possible arguments of initial find()
methods.
So my question is more general : What is the benefit of using overloaded methods in code since it reduce readability?
© Programmers or respective owner