• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like

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

best.
 
Those are the largest trousers in the world! Especially when next to this ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic