You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Konstantine Karantasis (Jira)" <ji...@apache.org> on 2021/07/09 03:41:00 UTC
[jira] [Updated] (KAFKA-7435) Consider standardizing the config
object pattern on interface/implementation.
[ https://issues.apache.org/jira/browse/KAFKA-7435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Konstantine Karantasis updated KAFKA-7435:
------------------------------------------
Fix Version/s: (was: 3.0.0)
3.1.0
> 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
> Priority: Major
> Fix For: 3.1.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
(v8.3.4#803005)