[
https://issues.apache.org/jira/browse/OPENNLP-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13161064#comment-13161064
]
Aliaksandr Autayeu commented on OPENNLP-402:
--------------------------------------------
About AbstractXXX classes. I have reviewed the hierarchy now, once again and
see some space for improvement. I agree it should be refactored once more.
Current hierarchy of AbstractXXX classes is made to avoid code duplication. It
is not very consistent in naming because I can't rename existing classes (I've
just been asked to revert one such proposal). Now I have reviewed it again and
see some possible improvements, but simplifying it to one class and interface
might make it easier to understand, but will make other things messy.
For example, I like the idea making format support more explicit in the
interface (supportedFormats, getHelp, etc above), but I don't like the idea of
mixing everything into one place. Things like " The parameter could be used for
anything, and must not always be a format. " is problematic, because it hides
the semantics of the parameter. If format parameter is not a format anymore, it
should be called differently, or made anonymous (e.g. args[]) otherwise it is
misleading.
Current class hierarchy !open-nlp-cli-package.png! (attached diagram) separates
the tools which does not need anything (CmdLineTool), the tools which work with
samples of some kind and recognize formats (AbstactTypedTool) and tools which
have parameters formalized (AbstractCLITool<P>). Then there are more specific
tools: trainers, cross validators, evaluators, etc.
I thought a bit and spaces for improvement lie in adding some methods from your
comment to interfaces, in improving this place: BaseCLITool extends
AbstractCLITool<Class>, and hierarchy just a bit (AbstractCLITool<P> and
CmdLineTool is kind of parallel).
> CLI tools and formats refactored
> --------------------------------
>
> Key: OPENNLP-402
> URL: https://issues.apache.org/jira/browse/OPENNLP-402
> Project: OpenNLP
> Issue Type: Improvement
> Components: Command Line Interface, Formats
> Affects Versions: tools-1.5.3-incubating
> Reporter: Aliaksandr Autayeu
> Labels: patch
> Attachments: 0016-CLI-tools-and-formats-refactored.patch,
> 0017-added-direct-format-support-to-CLI-tools-and-formats.patch
>
>
> Proposed patch refactors CLI tools and simplifies the code by introducing
> hierarchy and removing a lot of code duplication. It also introduces better
> error and help messages, including help for formats and listing available
> formats in various tools, which are now able to work with formats directly.
> This, in turn, eliminates the need to keep converted files on disk.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira