dimanche 17 mai 2020

Package organization and project structure design

I am trying to create a textsearcher library in java, that will have an interface TextSearcher and 3 classes implementing it: RegexPatternSearcher, SingleTokenSearcher and MultiTokenSearcher

I then created a TextSearcherFacade class that exposes static methods like:

  1. static findEmailAddresses(String input) - uses RegexPatternSearcher
  2. static findPhoneNumbers(String input) - uses RegexPatternSearcher
  3. static findDisallowedWords(String input, Set<String> disAllowedWords) - uses SingleTokenSearcher

I want users of the library to have these (i.e. methods from TextSearcherFacade) simple methods exposed for ease of use.

However, I don't like the idea of a single TextSearcherFacade class with methods that configure and create the RegexPatternSearcher, SingleTokenSearcher and MultiTokenSearcher because these methods depend on different classes and seem logically different.

I am trying to look for a better and more extensible way to design this library. Any help is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire