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 DA1339906 for ; Sat, 10 Mar 2012 01:18:57 +0000 (UTC) Received: (qmail 45489 invoked by uid 500); 10 Mar 2012 01:18:57 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 45265 invoked by uid 500); 10 Mar 2012 01:18:55 -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 45236 invoked by uid 99); 10 Mar 2012 01:18:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 01:18:54 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [80.237.132.80] (HELO wp073.webpack.hosteurope.de) (80.237.132.80) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Mar 2012 01:18:44 +0000 Received: from p03eb43.osaknt01.ap.so-net.ne.jp ([121.3.235.67] helo=[192.168.1.21]); authenticated by wp073.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1S6Awx-00020z-V8; Sat, 10 Mar 2012 02:18:24 +0100 Message-ID: <4F5AABD9.9060807@leichtgewicht.at> Date: Sat, 10 Mar 2012 10:18:17 +0900 From: Martin Heidegger User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: flex-dev@incubator.apache.org Subject: Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK References: <503131DD-2947-4AF1-9815-DD4CFF6B028A@classsoftware.com> <1331309633.52878.YahooMailNeo@web110414.mail.gq1.yahoo.com> <4F5A5A44.20209@leichtgewicht.at> In-Reply-To: Content-Type: multipart/mixed; boundary="------------040306040506020604010608" X-bounce-key: webpack.hosteurope.de;mh@leichtgewicht.at;1331342324;0e9a21cd; X-Virus-Checked: Checked by ClamAV on apache.org --------------040306040506020604010608 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/03/2012 09:03, Justin Mclean wrote: > Couldn't find an instance of this can you point out which file? Sorry, my fault, was browsing old version. > I don't see it as an issue as the alternative would involve 3 if > statements and an extra variable. Couldn't you just use var invalidFormat: Number = 0 or 1 ? > I can't find any instances of that either. I used the "local" bracket style with the exception of single line if statements which was discussed (briefly) on the list the other week. > > if () > doSomething(); > else > doSomethingElse(); > > while compact without braces can lead to errors when modified at a later date. PostCodeValidator - Line 560 > >> *) You mix "brace in new line" (left) with "brace in current line" (right), afaik its in the current line. > Again I can't find an instance of this in the formatter or validator classes. I find the brace on current line more compact and have used that style in the unit tests. I think there is a definite standard on that in the code guidelines of flex. however: PostCodeValidator - 499 & 513 just as one example >> *) You have string checks like "if(value)" this also checks on "" but that is actually a valid "format", right? > I had considered "" as a invalid format as it's not particularly interesting. I'll double check the unit tests around this. It would be good to add that case to the documentation. > >> *) if() { return ... } return; is less good readable compared to if() { return } else {return} again: Not sure what the style guide says. > The SDK use both styles. Personally I see bad sides in the one with the missing else ... however: again: What did the Flex Gui > It may be nice to know all errors for formats at a later date. We're > only talking about very small arrays here. I made the experience that programming for possibilities is a very bad idea. I am not necessarily talking about the performance (which it also affects) but also the readability. >> *) I have seen Japanese people writing their postal code with the unicode character prefix: 〒 That is not an accepted Format > From what I've read the ITU only accepts A-Z and 0-9, but I certainly have no issue in expanding the character range. The question is how this util is defined (documentation) if it validates to the ITU standard it should mention that. But if its about usability: Japanese people certain > >> *) Japanese do have wide format numbers that they also like to use in postal adresses: 0123456789 > I'll also look into this. This is a big problem for all number validation in japan. Oh: They also have double width A-Z ABC...XYZ: try to build a search engine around that! >> *) extraValidation is not sufficiently documented: No mention that the input can be null, no mention that the output has to be >> one of the error types that it can deal with. I would expect following signature: extraValidation(postCode:String, baseField:String):Vector.; > Will add more documentation. The existing mx class don't use arrays not vectors so changing it to use vectors could cause confusion in people using multiple validator classes. I see thanks! And thinking about it further: shouldn't the "result" have a error-weight? To be compared with other errors? > The signature is in the same format as the other mx validate classes > and is familiar to people who use them. I agree your signature is > better but it's probably not the time to be changing them all. I do not see a need for this to be consistent, does it? Anyways: I will not a refactoring of this signature for Flex X somewhere. >> *) I would put the static functions in their own function file to reduce dependency hell. > Again this is not the style of the currently validiators And I don't want to go down the path of rewriting all of them just yet:-) Same here: not sure this it is necessary to continue that trend :-) >> *) suggestFormat Should be separated from the Validator as it is not "necessary" to use the Validator (dependencies, dependencies) > I think the connivence of having a single class is better. But happy to be convinced otherwise. Can you give a code sample? I attached three examples how it think it could work else. All have less dependencies and better performance. > Fp 10.2 is the earliest version the current 4.6 SDK will compile with (and that's only after I changed the build scripts) Just because it compiles to this version doesn't mean it will work from this version on?! it is compilable with earlier SDK's as well ?! >> *) @private >> public function set formats >> >> What is this setter good for? > For setting multiple formats: eg > validator.formats = ["AN NAA", "ANN NAA", "AAN NAA", "ANA NAA", "AANN NAA", "AANA NAA"]; Then my question would be: Why is it private? yours Martin. --------------040306040506020604010608 Content-Type: application/gzip; name="flex.tar.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="flex.tar.gz" H4sICNCqWk8CAGZsZXgudGFyAO1ZWXPaMBDmlfyKrZ+STPEVjtYhad0cvaEDpH3oMB1hBLg1 NmMLStrJf+/KJ5eBtIGZtt5JsCx9K6+8q08reTiVcrsWKMqVSgVywEVeuIY3ilJRyyVVkcsn eF8sqUXIlXKZ7FrQ/xNimV3CHNfbUSjcx/8VtYL35Yp8kvl/HzLv/5HjMcPp0oc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