John Roesler created KAFKA-7435: ----------------------------------- Summary: Consider standardizing the config object pattern on interface/implementation. Key: KAFKA-7435 URL: https://issues.apache.org/jira/browse/KAFKA-7435 Project: Kafka Issue Type: Improvement Components: streams Reporter: John Roesler Fix For: 3.0.0
Currently, the majority of Streams's config objects are structured as a "external" builder class (with protected state) and an "internal" subclass exposing getters to the state. This is serviceable, but there is an alternative we can consider: to use an interface for the external API and the implementation class for the internal one. Advantages: * we could use private state, which improves maintainability * the setters and getters would all be defined in the same class, improving readability * users browsing the public API would be able to look at an interface that contains less extraneous internal details than the current class * there is more flexibility in implementation Alternatives * instead of external-class/internal-subclass, we could use an external *final* class with package-protected state and an internal accessor class (not a subclass, obviously). This would make it impossible for users to try and create custom subclasses of our config objects, which is generally not allowed already, but is currently a runtime class cast exception. Example implementation: [https://github.com/apache/kafka/pull/5677] This change would break binary, but not source, compatibility, so the earliest we could consider it is 3.0. To be clear, I'm *not* saying this *should* be done, just calling for a discussion. Otherwise, I'd make a KIP. Thoughts? -- This message was sent by Atlassian JIRA (v7.6.3#76005)