On 1/13/11, Arlo <arlo.carr...@gmail.com> wrote:
> This group is the best thing that happen to the internet since
> broadband!  You guys are awesome!  I definitely appreciate all
> feedback and I am taking everything into consideration.  What I really
> need to apply from this discussion is type checking,

jQuery came up as an example of that. And jQuery has had more than
enough problems with typechecking, mostly WRT host object.

so that param1
> can be an object or a string depending on how the user plans to use
> the method.  For now, I am taking this approach.
>
> function drawPoly(args)

I would remove that comment and rename that from "args" to something
like "options".

> {
>      // Set up params
I would move this to another function:

>      args         = args || {};
>      args.points  = args.points || DEFAULT_POINTS;
>      args.options = args.points || DEFAULT_POLY_OPTIONS;
>      args.foo     = args.foo || DEFAULT_FOO;
>
As in:
var pointConfig = getPointConfig( options );

>      // Function Flow

Meaningless comment.

> }
>
> This seemed to be the general consensus of our discussion.

Typechecking and fake overloading strategies, examples thereof, their
pitfalls, all have been covered on c.l.js over many many years.
\=-
Garrett

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to