Return-Path: Delivered-To: apmail-lucene-hadoop-dev-archive@locus.apache.org Received: (qmail 24440 invoked from network); 6 Feb 2007 06:46:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Feb 2007 06:46:27 -0000 Received: (qmail 3852 invoked by uid 500); 6 Feb 2007 06:46:34 -0000 Delivered-To: apmail-lucene-hadoop-dev-archive@lucene.apache.org Received: (qmail 3602 invoked by uid 500); 6 Feb 2007 06:46:33 -0000 Mailing-List: contact hadoop-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hadoop-dev@lucene.apache.org Delivered-To: mailing list hadoop-dev@lucene.apache.org Received: (qmail 3593 invoked by uid 99); 6 Feb 2007 06:46:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Feb 2007 22:46:33 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Feb 2007 22:46:26 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B61257142D4 for ; Mon, 5 Feb 2007 22:46:05 -0800 (PST) Message-ID: <26619189.1170744365743.JavaMail.jira@brutus> Date: Mon, 5 Feb 2007 22:46:05 -0800 (PST) From: "Owen O'Malley (JIRA)" To: hadoop-dev@lucene.apache.org Subject: [jira] Commented: (HADOOP-948) Coding style issues In-Reply-To: <1697946.1170100009438.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470459 ] Owen O'Malley commented on HADOOP-948: -------------------------------------- Irrational fear of a second return has lead to lots of unnecessary code branches, in my experience. I'd rather see a return early in a function that a nested if branch that includes the rest of the body of the function. > Coding style issues > -------------------- > > Key: HADOOP-948 > URL: https://issues.apache.org/jira/browse/HADOOP-948 > Project: Hadoop > Issue Type: Bug > Components: metrics > Reporter: David Bowen > Priority: Minor > Attachments: hadoop-948.patch > > > I would like to recommend some mainly stylistic changes in the recent fix of http://issues.apache.org/jira/browse/HADOOP-886. The file in question is CodeFactory.java, and the reasons for the changes are: > * It is generally preferable to avoid multiple return statements. > * It is nearly always preferable to use curly braces and a newline after an if (condition). > * There's no benefit to doing the hash lookup twice in the common case (by calling contains and then get). > (1) and (2) are commonly found in Java coding style guidelines as they make the code more readable. > I'll attach the fix shortly. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.