-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename all methods in TransitService according to naming conventions #6249
Rename all methods in TransitService according to naming conventions #6249
Conversation
There were merge conflicts so I had to merge dev-2.x. |
Collection<Agency> getAgencies(); | ||
Optional<Agency> findAgencyById(FeedScopedId id); | ||
Collection<Agency> listAgencies(); | ||
Optional<Agency> findAgency(FeedScopedId id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be getAgency
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns an optional, so that's why it's find
.
|
||
FeedInfo getFeedInfo(String feedId); | ||
|
||
Collection<Notice> getNoticesByEntity(AbstractTransitEntity<?, ?> entity); | ||
Collection<Notice> findNotices(AbstractTransitEntity<?, ?> entity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit on the edge if we can use the standard findX
convention for this method. In general, I think there are a lot of cases where it would improve the readability a bit to explains in the method name how the argument is used for the search. I would prefer findNoticesForEntity
in this case. We can discuss this in a dev meeting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning a collection means find
|
||
/** | ||
* Return the routes using the given stop, not including real-time updates. | ||
*/ | ||
Set<Route> getRoutesForStop(StopLocation stop); | ||
Set<Route> findRoutes(StopLocation stop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, it returns a collection, that's why find
.
Collection<StopLocation> getStopOrChildStops(FeedScopedId id); | ||
Collection<StopLocation> findStopOrChildStops(FeedScopedId id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intuition here would be to use get because the argument is an id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection is find
Collection<Route> getRoutesForGroupOfRoutes(GroupOfRoutes groupOfRoutes); | ||
Collection<Route> findGroupsOfRoutes(GroupOfRoutes groupOfRoutes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name should be findRoutes
but I prefer a longer version like findRoutesForGroupOfRoutes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the short version, because the argument is part of the method signature - DRY
|
||
/** | ||
* Return the TripOnServiceDate for a given id, including real-time updates. | ||
*/ | ||
TripOnServiceDate getTripOnServiceDateById(FeedScopedId datedServiceJourneyId); | ||
TripOnServiceDate findTripOnServiceDate(FeedScopedId datedServiceJourneyId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is again a bit on the edge, get or find?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument name is old, it should be tripOnServiceDateId
/id
not datedServiceJourneyId
. Again I prefear id
because it is DRY.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aacd1d7
The conflict was only about imports so I used my admin rights to merge even though your reviews were dismissed. |
Summary
We have had naming conventions for a while but many central pieces don't actually adhere to it. This PR changes all names in
TransitService
to use the conventions.I made two small functional changes:
getScheduledTrip
was moved toTransitEditorService
Issue
#6048