I'm finishing up a port I did of a portion of a Java Library. The library calculates sunrise and sunset for a given latitude and longitude. The original Java library also calculated various times based on sunrise and sunset, which I plan to get to later.
That said, I'm working with Objective-C and the Cocoa touch framework. The original methods, being Java, all began with
get and took their arguments in parenthesis. However, Objective-C has a different method structure, so the methods end up looking different. For example,
public double getUTCSunset(AstronomicalCalendar astronomicalCalendar,
double zenith, boolean adjustForElevation)
- (double) getUTCSunsetForDate:(NSDate*)date andZenith:(double)zenith adjustForElevation:(BOOL)adjustForElevation.
The problem here is twofold. First of all, according to the Apple Documentation on coding convention, method names (and "getters"), should not include
get in them. However, a second issue arises if we drop the
get. We end up with a method signature that begins with a capital letter, which is also not supposed to happen.
How would you rewrite this method, while keeping the method signatures similar enough to be recognizable to each other?