Simon Nash wrote:
To improve consistency between the various parts of the ever-growing
travel sample, I'd like to propose the following naming conventions:

Contribution names:

  All lower case, can contain hyphens
  Examples: calendar, car, creditcard-payment-jaxb, emailgateway

Java package names:

  Interfaces should be in com.tuscanyscatours
  Implementation classes should be in com.tuscanyscatours.impl
  Use other packages where needed for specific scenarios
    - e.g., com.goodvaluetrips and com.goodvaluetrips.impl

Implementation class names:

  CamelCase with initial capital, ending with "Impl" suffix
  Examples: TripBookingImpl, ShoppingCartImpl, SCAToursImpl

Interface names:

  CamelCase with initial capital, no special suffix
Impl classes with 1 service interface: impl name with "Impl" suffix removed Impl classes with >1 service interface: don't use the impl name with "Impl" suffix removed
  Examples: TripBooking, SCAToursSearch, SCAToursBooking

Component names:

  Impl class name (without Java package) with "Impl" suffix removed
  Examples: TripBooking, ShoppingCart, SCATours

Service names:

  Interface name (without Java package)
  Examples: TripBooking, SCAToursSearch, SCAToursBooking

Reference names:

  camelCase with no initial capital
  Examples: payment, cartStore

Property names:

  camelCase with no initial capital
  Examples: currency, exchangeRate


Comments, suggestions, questions?

  Simon


I didn't get any reactions to this, so I have updated the introducing-*
samples to match these conventions (more or less).  The changes are:

1. Renamed contribution and launcher directories so that the words
   "contribution" and "launcher" don't appear in the directory name.

2. Renamed maven artifacts to scatours-contribution-xxx and
   scatours-launcher-xxx, where xxx is the directory name.

3. Moved the implementation classes into .impl packages and added
   an "Impl" suffix to the class names.

I have not changed the interface/service names.  This means that some
interface/service names don't exactly follow the convention above
(e.g., the TripProviderImpl class has a single service called Trips,
not a single service called TripProvider).  I don't think this is a
problem, so I'm inclined to change the convention for interface names
to the following:
  Impl classes with 1 service interface: either use the impl name with
     "Impl" suffix removed, or use some other name
  Impl classes with >1 service interface: don't use the impl name with
     "Impl" suffix removed

I also changed the launcher class names to xxxLauncher, and I simplified
the launcher code by eliminating the launchFromFileSystemDir() method
and the try/catch for Exception inside this method.  Is there a reason
for having these?

Any comments on what I have done for the introducing-* code?  If people
like these changes, I'll go ahead and update the other sample code to
use the same conventions.

  Simon

Reply via email to