This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes Best practice for resolving overloaded method names for Doc/Lit Wrapped Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Best practice for resolving overloaded method names for Doc/Lit Wrapped" Watch "Best practice for resolving overloaded method names for Doc/Lit Wrapped" New topic
Author

Best practice for resolving overloaded method names for Doc/Lit Wrapped

Wei Hsu
Greenhorn

Joined: Feb 23, 2004
Posts: 11
Hi all,

I am in the process of exposing an exisiting service as a Doc/Lit Wrapped Service. I know that Doc/Lit Wrapped does not support method name overloading, so i am left with the task of trying to resolve it for my services. I was just wondering if there were any industry-standard 'best practice' for doing this.

For instance, let's say i have the following:

Cat modify(Cat c)
Cat modify(Cat c, String name)
Dog modify(Dog d)

Some of the possible solutions include:

1) Appending numbers

Cat modify1(Cat c)
Cat modify2(Cat c, String name)
Dog modify3(Dog d)

2) More informative names

Cat modifyCat(Cat c)
Cat modifyCat2(Cat c, String name)
Dog modifyDog(Dog d)

3)

Cat modifyCat(Cat c)
Cat modifyCatWithName(Cat c, String name)
Dog modifyDog(Dog d)

4) put parameters into the name

Cat modify_Cat(Cat c)
Cat modify_Cat_String(Cat c, String name)
Dog modify_Dog(Dog d)

And so on.

As you can see, the possibilities are endless. I know it's quite subjective, but i'm still curious what most people think. Any help would be appreciated. Thanks!

Wei
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I like

Cat modifyCat(Cat c)
Cat modifyCatWithName(Cat c, String name)
Dog modifyDog(Dog d)

best.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
 
subject: Best practice for resolving overloaded method names for Doc/Lit Wrapped