On Aug 18, 2009, at 12:11 PM, Chris Paveglio wrote:
But if there is not a second phone/fax number, I don't really care
if this line fails. I certainly *could* write a check like "if
(originalFax != @"") then... continue with function". But would that
take more time to process?
Look up the term "premature optimization".
I'd like to summarize what others said in a way that you should
always remember:
"Hmmm ... do I keep my buggy code and spam the user's system log
with evidence of my lazy code or sacrifice 1 millisecond for an
operation that's only going to happen a few times a second at most to
fix the bug?"
Of *course* you fix the error!
Performance-wise, even if this formatting were happening hundreds
of times a second, the single if conditional is *still* only going to
be a fraction of all the rest of the work you're performing in that
operation. But it's not even happening that fast. It's happening in
response to user input. Several times a second at best for typing a
number.
On Aug 18, 2009, at 12:25 PM, Alastair Houghton wrote:
Also, PLEASE remember that there are people who don't live in the
United States!
WHAT?! Oh, those poor dears! ;-)
In seriousness, yes, very valid point. There are, however, no good
localized (localised?) "phone number formatters" built into the system
so rolling your own is no small task. If you can't find a good open
source solution, it's probably best to either turn off the formatter
when not in "US" mode, or just don't force formatting at all.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com