This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Appropriate Method name?

 
Amruta Jegarkal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My method returns boolean value.....It accepts Event class object as parameter....Event is a class with property like name,type of event,dateof event,time,id with setters/getters......This method deletes event from file.txt if id in event sent is present in file.....Sends true if id is present else false.......Suggest me a appropriate name for this method as isDeleteEvent() is not appropriate as per my sir.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would just call it deleteEvent.

Since the method has a side effect (it changes the state of a file), I would indeed not call it isDeleteEvent, because that name suggests the method is a getter method, which should not change the state of any object or file.
 
Matthew Brown
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Jesper. Either deleteEvent or removeEvent.

I tend to try and use create/delete and add/remove in pairs, so which of the two I'd choose would probably depend on what the corresponding method for adding events to the file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic