• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Repeating function names for different classes

 
Michael Fisherman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a naming/documentation perspective, is it fine to use the same function
name for different classes when both functions serve the same purpose but one function serves more as a delegate. For
example in my URLyBird project the DBAccess: void readRecord(long recNo) throws RecordNotFoundException and my Remote interface has the same
void readRecord(long recNo) throws RecordNotFoundException {
..
dbInstance.readRecord(recordNo);
..
}

or is it more appropriate to call the function something like readRecordDelegate ?
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'll give you my opinion..

Originally posted by Michael Fisherman:
[QB]From a naming/documentation perspective, is it fine to use the same function name for different classes when both functions serve the same purpose but one function serves more as a delegate.


I think it is fine and most likely with Delegate.

Consider this: http://best-practice-software-engineering.ifs.tuwien.ac.at/patterns/delegation.html

or the description of "decorator" (not quite Delegation) in "Head First Design Pattern" (p90) :
http://books.google.com.hk/books?id=LjJcCnNf92kC&dq=google+head+first+design+patterns&pg=PP1&ots=_9Y-5Hn3x0&sig=IoRTu1wFhuuMJMXUhquzsHOpdeE&hl=en&prev=http://www.google.com.hk/search?complete=1&hl=en&client=firefox-a&rls=org.mozilla:en-US fficial&hs=qEJ&q=google+Head+First+Design+Patterns&btnG=Search&sa=X&oi=print&ct=title&cad=one-book-with-thumbnail#PPA90

Perfectly fine up to me, as long as the method name represent what it is doing.

Regards,
Alex
 
Michael Fisherman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this is a late reply, but thanks Alex. My fears are assuaged
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic