Simon Laws wrote:
...snip
1. Renamed contribution and launcher directories so that the words
"contribution" and "launcher" don't appear in the directory name.
+1
2. Renamed maven artifacts to scatours-contribution-xxx and
scatours-launcher-xxx, where xxx is the directory name.
+1
>
On reflection I think this can be improved by using scatours-xxx
for the contribution artifacts and scatours-launcher-xxx for the
launchers. This means the contribution jar files produced by
maven will have names like scatours-introducing-tours.jar instead
of scatours-contribution-introducing-tours.jar. This feels more
natural to me.
3. Moved the implementation classes into .impl packages and added
an "Impl" suffix to the class names.
+1
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
by 'don't use the impl name with "Impl" suffix removed' do you mean
that for a component implemented using MyComponentImpl none of the
multiple service interfaces can be called MyComponent.
Yes, I'm suggesting that this style should only be used in the case
where MyComponentImpl has a single service. However I don't want to
rule out the possibility of using some other name in the single
service case.
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?
So that you can see, on the console, any exceptions that are thrown?
This works even better without the try/catch. When running a Java
main() method from the command line, the Java runtime catches any
exceptions thrown by the main() method and prints them with a stack
trace. See the IntroducingLauncher class for an example of writing
a launcher in this style.
Simon
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
Simon