Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like

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

best.
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!