FWIW, at Adobe, the philosophy was to not do much input checking.
"Garbage-in, Garbage Out".  If you pass in garbage, it is ok to get an
exception thrown back at you.  Theoretically, folks debug their code to the
point where it won't need these checks in production.  Sure, any individual
check is small and probably leads to better developer productivity, but they
all add up to a bigger and slower runtime when they shouldn't be needed.

In fact, one of my hopes for FlexJS and its "beads" is to make it possible
for folks to swap in debug-mode beads that do have helpful input checking
and then swap in production-mode beads later.


On 5/5/13 11:32 PM, "jmcl...@apache.org" <jmcl...@apache.org> wrote:

> Updated Branches:
>   refs/heads/develop 659a9234f -> 63bd807f8
> 
> 
> FLEX-26048 check if date range actually contains dates
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/63bd807f
> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/63bd807f
> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/63bd807f
> 
> Branch: refs/heads/develop
> Commit: 63bd807f8e087e164d5b6fce846bc4a917f3f140
> Parents: 659a923
> Author: Justin Mclean <jmcl...@apache.org>
> Authored: Mon May 6 16:21:31 2013 +1000
> Committer: Justin Mclean <jmcl...@apache.org>
> Committed: Mon May 6 16:21:31 2013 +1000
> 
> ----------------------------------------------------------------------
>  .../projects/mx/src/mx/controls/DateChooser.as     |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/63bd807f/frameworks/proje
> cts/mx/src/mx/controls/DateChooser.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/mx/src/mx/controls/DateChooser.as
> b/frameworks/projects/mx/src/mx/controls/DateChooser.as
> index 27fe888..ed05856 100644
> --- a/frameworks/projects/mx/src/mx/controls/DateChooser.as
> +++ b/frameworks/projects/mx/src/mx/controls/DateChooser.as
> @@ -3120,14 +3120,14 @@ public class DateChooser extends UIComponent
> implements IFocusManagerComponent,
>          else if (value is Object)
>          {
>              var range:Object = {};
> -            if (value.rangeStart)
> +            if (value.hasOwnProperty("rangeStart") && value.rangeStart is
> Date)
>              {
>                  range.rangeStart = new Date(value.rangeStart.getFullYear(),
>                                              value.rangeStart.getMonth(),
>                                              value.rangeStart.getDate());
>              }
>              
> -            if (value.rangeEnd)
> +            if (value.hasOwnProperty("rangeEnd") && value.rangeEnd is Date)
>              {
>                  range.rangeEnd = new Date(value.rangeEnd.getFullYear(),
>                                            value.rangeEnd.getMonth(),
> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Reply via email to