Closed mscwilson closed 2 years ago
On closer inspection, the classes using Style 1 are those that do not extend an abstract class, i.e. Tracker and Subject. The classes using Style 2 inherit from AbstractEmitter, AbstractEvent, or AbstractHttpClientAdapter. So there is a certain amount of "Java being Java" going on.
It should still be possible to change the structure so the API looks the same. After nearly 4 months working on this tracker I've still had to look up how to create a new tracker component every time.
The Builder pattern is used extensively in the Java tracker. However, two different styles are implemented. For example:
Style 1:
There is a TrackerBuilder nested class.
Style 2:
There are Builder and Builder2 nested classes.
Tracker and Subject use Style 1. Emitters and Events (PageView, etc) use Style 2. This isn't great for usability. Style 2 code is also quite hard to follow. It would be helpful to standardise all the public API classes to use Style 1.