You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jay Kreps (JIRA)" <ji...@apache.org> on 2011/08/13 20:49:27 UTC
[jira] [Created] (KAFKA-96) Add a style guide for kafka site
Add a style guide for kafka site
--------------------------------
Key: KAFKA-96
URL: https://issues.apache.org/jira/browse/KAFKA-96
Project: Kafka
Issue Type: Improvement
Components: website
Reporter: Jay Kreps
Assignee: Jay Kreps
Priority: Minor
We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085811#comment-13085811 ]
Jay Kreps commented on KAFKA-96:
--------------------------------
Updated the site with everyones suggestions. Thanks all.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085794#comment-13085794 ]
Jay Kreps commented on KAFKA-96:
--------------------------------
I found this as a sort of semi-standard scala style guide:
http://davetron5000.github.com/scala-style/ScalaStyleGuide.pdf
I thought it was quite good. The only place I think we differ is that we do
while(true) {...}
instead of
while (true) {
I don't particularly care one way or another on that one, but it would be good to have consistency.
I recommend we adopt this guide.
The meaning of compatibility is really: there should always be a no-downtime upgrade path from release to release. I will clarify that.
Yes, the sleeps crept in. Overall i think we have added a lot of tests (good), but the quality has gone down a lot (lots of cut and paste, lots of hardcoded values, and lots of non-deterministic sleeps which fail about 25% of the time on my machine and are slow). I think we have some work to do. We can start by just not adding to them.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Chris Burroughs (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085798#comment-13085798 ]
Chris Burroughs commented on KAFKA-96:
--------------------------------------
Sounds good to me. Thanks for putting this together.
I'll try to start identifying the tests that fail spuriously most often in Jenkins.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jakob Homan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085284#comment-13085284 ]
Jakob Homan commented on KAFKA-96:
----------------------------------
We've not made much use of Scala's Option and instead have relied on Java's null. Would it be worth adding that Option should be prefered in an effort to push the code to more idiomatic Scala?
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jun Rao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084739#comment-13084739 ]
Jun Rao commented on KAFKA-96:
------------------------------
That's a good list. I agree with most of the items. I want to add 1 more:
* avoid duplicating code when possible.
About enforcing backward compatibility. I agree that we should try to do that as much as we can. However, for major changes like replication. This is going to be hard. For example, an old client will not understand the concept of logical partitions, replicas of a partition, the leader of a partition, etc. One benefit of a streaming engine is that one can upgrade by creating a new instance of the brokers using the new version, upgrade the producer and point it to the new brokers, drain the old consumer and finally upgrade the consumer and point it to the new brokers. This should still allow minimal down time. Also, should backward compatibility be maintained just for the previous version or for all old versions? If it's the latter, the code may become harder and harder to maintain going forward.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084741#comment-13084741 ]
Jay Kreps commented on KAFKA-96:
--------------------------------
Cool, I will add that.
I wanted to have the section on compatibility just because my experience previously is that people don't think about it at all. This is not to say we will never break compatibility, just that it is something that has to be thought through with each feature. I will try to clarify that.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jay Kreps updated KAFKA-96:
---------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
Cool, I will take that to be consensus. I added all suggestions but am going to hold off on String.format since it sounds like there are pros and cons.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085304#comment-13085304 ]
Jay Kreps commented on KAFKA-96:
--------------------------------
The issue with Option is that we heavily make use of java libraries which use null, so at best we will just get a mix of styles. I am fine recommending it.
String.format is a good recommendation.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Neha Narkhede (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085298#comment-13085298 ]
Neha Narkhede commented on KAFKA-96:
------------------------------------
+1 on using Scala Option. It forces you to handle null values in a cleaner fashion
I'd also like to add this in the context of logging -
* prefer using string.format() instead of several string concatenations
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085324#comment-13085324 ]
Jay Kreps commented on KAFKA-96:
--------------------------------
Err, maybe not: http://stackoverflow.com/questions/513600/should-i-use-javas-string-format-if-performance-is-important
Sounds like the String.format doesn't get the same built in optimization that the + operator does so it is about 5x slower.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-96) Add a style guide for kafka site
Posted by "Chris Burroughs (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085697#comment-13085697 ]
Chris Burroughs commented on KAFKA-96:
--------------------------------------
I created KAFKA-105 to split off the logging discussion. I think we can have cleaner and faster code with slf4j.
Is there a canonical scala guide you want to reference for indentation and stuff like that?
Backwards compatibility: I read that as one release alone the lines of 0.x.y and 0.x+1.y must be backwards compatibility. But every 0.x.y and 0.y.y+n release must be.
We have some work to do if we want to eliminate all sleeps in tests:
$ grep -rni sleep core/src/test/ | wc -l
89
Excited to see @threadsafe and friends enforced.
Nits:
* There are four levels of logging TRACE, DEBUG, INFO, WARN, ERROR, and FATAL (That's more than 4)
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jay Kreps updated KAFKA-96:
---------------------------
Status: Patch Available (was: Open)
Patch is attached.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jay Kreps closed KAFKA-96.
--------------------------
Page is up, we can do further suggestions as one-offs. Closing this issue.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-96) Add a style guide for kafka site
Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jay Kreps updated KAFKA-96:
---------------------------
Attachment: kafka_coding_guide.txt
Here are the guidelines.
> Add a style guide for kafka site
> --------------------------------
>
> Key: KAFKA-96
> URL: https://issues.apache.org/jira/browse/KAFKA-96
> Project: Kafka
> Issue Type: Improvement
> Components: website
> Reporter: Jay Kreps
> Assignee: Jay Kreps
> Priority: Minor
> Attachments: kafka_coding_guide.txt
>
>
> We have actual contributors now (yay!) so it might be good to consider having a style/coding guide that covers what is expected for new development or submitted patches. In my experience these guidelines are always a bit personal, and only work if there is real agreement amongst contributors. I have written up the guide which reflects at least the early code. I would love to get people's feedback on whether anything is missing or questionable and see if we could adopt these.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira