You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Sharmarke Aden (JIRA)" <ji...@apache.org> on 2013/09/04 16:29:57 UTC

[jira] [Created] (KAFKA-1040) ConsumerConfig and ProducerConfig do "work" in the Constructor

Sharmarke Aden created KAFKA-1040:
-------------------------------------

             Summary: ConsumerConfig and ProducerConfig do "work" in the Constructor
                 Key: KAFKA-1040
                 URL: https://issues.apache.org/jira/browse/KAFKA-1040
             Project: Kafka
          Issue Type: Improvement
          Components: config, consumer, producer 
    Affects Versions: 0.8
         Environment: Java 1.7
Linux Mint 14 (64bit)
            Reporter: Sharmarke Aden
            Assignee: Neha Narkhede
            Priority: Minor


It appears that validation of configuration properties is performed in the ConsumerConfig and ProducerConfig constructors. This is generally bad practice as it couples object construction and validation. It also makes it difficult to mock these objects in unit tests. 

Ideally validation of the configuration properties should be separated from object construction and initiated by those that rely/use these config objects.

http://misko.hevery.com/code-reviewers-guide/flaw-constructor-does-real-work/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira