Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Wei Hsu
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
 
Lasse Koskela
author
Sheriff
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic