wood burning stoves 2.0*
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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Appropriate Method name?
 
Similar Threads
WebSphere V5 CMP create problem
difference between classes??
callbacks
xStream doesn't work correct with list and attributes
Lazy loading not working as expected