Description
I vote for using singular in all package and type names, unless it is a collection of something. Here are some examples (Here is about top 50% of the OTP classes matching class \w+s[\p{Lu} ]
):
- AreaStopToVertexMapper not AreaStopsToVerticesMapper
- BikesAllowedMapper not BikeAllowedMapper
- ConsolidatedStopNameDecorator not DecorateConsolidatedStopNames
- EmissionSomeThing, not EmissionsSomeThing
- EnumTypeDefinitions, not EnumTypes (Transmodel API)
- FareConfiguration, not FaresConfiguration
- GeofencingZoneNnn, not GeofencingZonesNnn
- Gram not Grams
- GtfsFareV2Service, not GtfsFaresV2Service
- Issue(Store|Repository|Service) not Issues ...
- ItineraryHelper not ItinerariesHelper
- ItineraryListFilter not ItinerarysFilter
- ItineraryFareDecorator, not ItineraryFaresDecorator
- ObjectMapperFactory, not ObjectMappers
- PathCollectionMerger not MergePaths
- UnitUtils not Units (This is deprecated and should be replaced by value objects)
Unsure about these:
- CombinedInterlinedLegs
- SomeThingPreferences
- SomeThingUtils
- TransmodelScalars, maybe TransmodelScalarDefinitions (keeping the s, but improving the name)
Not change these:
-
APIEndpoints (Could use APIEndpointService)
-
GraphQL Query types (GraphQLAccessibilityPreferencesInput, ...)
-
IssueColors - List of colors and utility functions
-
NumOfItinerariesFilter - The filter is named after the
numOfItineraries
request parameter. -
OpeningHours
-
OtpFileNames - List of config file names, could be OtpConfigFileNames
-
RemoveOtherThanSameLegsMaxGeneralizedCost - Here the meaning changes dramatically. The meaning of OtherThanSameLeg is different from OtherThanSameLegs.
-
StopTimes(Nnn)
-
UpdaterStatusResource
-
Package
api
is the framework, whileapis
contain the collection of all official OTP APIs (except Sandbox)
Using suffixes like List
, Info
, Service
, Repository
, Factory
, Definitions
, and Utils
is ok, and can in some cases make the type read more easy and at the same time avoid the s
.
Note! In many Java libraries the suffix s
is used for utility classes, but we uses Utils
(TimeUtils
)
Originally posted by @t2gran in #6558 (comment)