Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D9639D3B for ; Sun, 11 Mar 2012 02:27:50 +0000 (UTC) Received: (qmail 67580 invoked by uid 500); 11 Mar 2012 02:27:49 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 67538 invoked by uid 500); 11 Mar 2012 02:27:49 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 67529 invoked by uid 99); 11 Mar 2012 02:27:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Mar 2012 02:27:49 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Mar 2012 02:27:40 +0000 Received: by iaag37 with SMTP id g37so4299543iaa.6 for ; Sat, 10 Mar 2012 18:27:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer:x-gm-message-state; bh=PYFKcrEtScoV6UMwu3OM83vuIDhHXRB5MbFL6khyPjg=; b=SK0KolFH//BIgx/IqCY2hBN3uBN3pEOSE1axfkRZZk7gyRFZMk10Dx6LL9ls+jBa4b rRNRw3GqQKY9O/LwsbyiWqkuSQYUz0jxomlUgUPtHzpY+K3MiJPkgRBgLne1cHsFBDBF iU053oKIa9zQEKrRFj8X8Jn2iY8rOOZEEAnLYFw66O9vk5N+460JFUoWLEn9ygRLI47F +a8IoY4MNO0ZK40wB1+Yx1lrdE/v7o1qkKMsyyqPKQKoMIKxJ3F7QHTNG7yqFrZ6tObL a37LigFEfOfc4QpP4h1U3HPgUWZBjD58F3SH9SjxHfT4pkhzIPGrJLJu2D3+FavOhS/R jFyA== Received: by 10.42.175.5 with SMTP id ay5mr9626911icb.42.1331432838584; Sat, 10 Mar 2012 18:27:18 -0800 (PST) Received: from [192.168.0.4] (124-149-169-202.dyn.iinet.net.au. [124.149.169.202]) by mx.google.com with ESMTPS id dl10sm7376763igb.9.2012.03.10.18.27.15 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Mar 2012 18:27:17 -0800 (PST) From: Justin Mclean Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: multipart/alternative; boundary="Apple-Mail=_5A3DA1DC-2203-4E31-9EBB-FBEAD6430EFB" Subject: Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK Date: Sun, 11 Mar 2012 13:27:10 +1100 In-Reply-To: To: flex-dev@incubator.apache.org References: <503131DD-2947-4AF1-9815-DD4CFF6B028A@classsoftware.com> <1331309633.52878.YahooMailNeo@web110414.mail.gq1.yahoo.com> <4F5A5A44.20209@leichtgewicht.at> <4F5AABD9.9060807@leichtgewicht.at> <01A4F49D-376D-4F38-BE8E-AEAC71A475BB@classsoftware.com> <4F5B2605.5070507@leichtgewicht.at> <3E4447FA-4E2C-4D52-AFB3-49916D8A679C@classsoftware.com> Message-Id: <7CF8459E-7172-4488-9B67-BD618171D602@classsoftware.com> X-Mailer: Apple Mail (2.1257) X-Gm-Message-State: ALoCoQmAic3BPbyGjivE8rpbx/7eKjK7CCaLY9WHsbS+vjUWP2oGeLJWmYIe6vksIDDFndzBVUBa X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_5A3DA1DC-2203-4E31-9EBB-FBEAD6430EFB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Hi, > What is the 1.5? We should try and not use any magic numbers/strings. A few lines above is the following comment. // We want invalid char and invalid format errors to show in preference // so give wrong length errors a higher value Re magic number string I agree in general but in this case my reasoning = at the time was not to as: 1. It totally internal to that one function 2. It's only used in one place and I can't see the potential for it to = be used elsewhere=20 3. It actually value is meaningless (just has to >1 and <2) It is possible that this would be a tiny bit clearer. Number(invalidFormat) + Number(invalidChar) + Number(incorrectFormat) + = Number(wrongLength) * IMPORTANT_ERROR If you look at the other validators they have hard coded strings and = values all over the place. This code is most likely of a higher standard = that what already exists in the Flex SDK both as originally submitted = and with all the changes based on feedback. If it really offends anyone that much please submit a patch :-) And = don't forget to run the unit tests! Thanks, Justin= --Apple-Mail=_5A3DA1DC-2203-4E31-9EBB-FBEAD6430EFB--