This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Appropriate Method name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Appropriate Method name?" Watch "Appropriate Method name?" New topic
Author

Appropriate Method name?

Amruta Jegarkal
Greenhorn

Joined: Nov 29, 2012
Posts: 29
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

Joined: Aug 16, 2005
Posts: 14952
    
  26

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4541
    
    8

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.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Appropriate Method name?
 
jQuery in Action, 3rd edition