Another valuable addition to the discussion is "How do you document an
options Object?" by Pamela Fox two years ago.
http://blog.pamelafox.org/2009/05/how-do-you-document-options-object.html
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/jsm
Rebecca's post and the comments really add to the discussion. Most of
the points made here were made there.
I'd like to add here that, for the - possibly rare - occasion when
you're not sure about the future of your routine's implementation
(regarding usage), passing an object is a nice way to not
On Mon, Jul 4, 2011 at 11:41 PM, RobG wrote:
>
>
> On Jul 4, 7:34 pm, "David Marrs" wrote:
> [...]
> > P.S. Please let me know if my MUA is a bit rubbish for mailing lists.
> > I noticed the formatting of my email in your quotes was a bit ugly.
>
> I'm using Google Groups, your replies are not
On Jul 4, 7:34 pm, "David Marrs" wrote:
[...]
> P.S. Please let me know if my MUA is a bit rubbish for mailing lists. I
> noticed the formatting of my email in your quotes was a bit ugly.
I'm using Google Groups, your replies are not well formatted at all:
http://groups.google.com/group/jsme
On Fri, Jul 1, 2011 at 8:13 PM, Jason Mulligan wrote:
> yes i am. extjs/jquery are fantastic examples of this paradigm gone
> wrong. the syntax ends up on multiple lines as you try to figure out
> what's what, and no IDE can accurately parse the docblock/expression/
> literal to say Param1 is ...
jsdoc-toolkit [http://code.google.com/p/jsdoc-toolkit/] already has an
approach to mark up object parameters in the form of:
/**
* @param userInfo Information about the user.
* @param userInfo.name The name of the user.
* @param userInfo.email The email of the user.
*/
--
Poetro
--
To
On 4 Jul 2011 06:16, RobG wrote:
Choosing to use objects with defined property names instead of formal
parameters isn't a language feature, it's a design decision. That IDEs
don't support it likely means it is too difficult to do easily
I think IDEs already use docblocks to get param info. It s
On Jul 2, 7:00 pm, Nick Morgan wrote:
> On 2 July 2011 01:13, Jason Mulligan wrote:
>
> > and, just to prove my point .. show me a built in function that
> > expects an object as a param.
>
> Are you saying that we should be modelling our APIs on the ones
> JavaScript supplies? Like `document.l
On Jul 2, 5:38 pm, "David Marrs" wrote:
> On 2 Jul 2011 01:13, Jason Mulligan wrote:
>
> > yes i am. extjs/jquery are fantastic examples of this paradigm gone
> >
> > wrong. the syntax ends up on multiple lines as you try to figure out
I think the issue is that general purp
On 2 July 2011 01:13, Jason Mulligan wrote:
> and, just to prove my point .. show me a built in function that
> expects an object as a param.
>
Are you saying that we should be modelling our APIs on the ones
JavaScript supplies? Like `document.location = url`? Most of the
JavaScript API is ugly
On 2 Jul 2011 01:13, Jason Mulligan wrote:
yes i am. extjs/jquery are fantastic examples of this paradigm gone
wrong. the syntax ends up on multiple lines as you try to figure out
what's what, and no IDE can accurately parse the docblock/expression/
literal to say Param1
apply() doesn't count .. cause well that's what it's supposed to do ;)
On Jul 1, 8:13 pm, Jason Mulligan wrote:
> yes i am. extjs/jquery are fantastic examples of this paradigm gone
> wrong. the syntax ends up on multiple lines as you try to figure out
> what's what, and no IDE can accurately par
yes i am. extjs/jquery are fantastic examples of this paradigm gone
wrong. the syntax ends up on multiple lines as you try to figure out
what's what, and no IDE can accurately parse the docblock/expression/
literal to say Param1 is ..., Param2 is ...
most of the time it's just bad design.
and, ju
On Jun 21, 4:26 am, Sidney San Martín wrote:
> To an extent, I agree… but how would you write a function like jQuery.ajax,
> which takes upwards of 30 optional parameters, in a more JavaScripty way?
Provide your own constructor:
function Ajax(...) {
...
}
var req = new Ajax(...);
On Jun 21, 4:07 am, Jason Mulligan wrote:
> Considering the language, sending an object of args is going against
> the convention of JavaScript due to laziness.
You've lost me. Are you saying passing an object is lazy?
--
Rob
--
To view archived discussions from the original JSMentors Mailma
to elaborate, there's no reason why a parameter can't be an object
containing optional parameters.
On Jun 20, 2:26 pm, Sidney San Martín wrote:
> To an extent, I agree… but how would you write a function like jQuery.ajax,
> which takes upwards of 30 optional parameters, in a more JavaScripty way?
carefully
On Jun 20, 2:26 pm, Sidney San Martín wrote:
> To an extent, I agree… but how would you write a function like jQuery.ajax,
> which takes upwards of 30 optional parameters, in a more JavaScripty way?
>
>
>
>
>
>
>
> On Mon, Jun 20, 2011 at 2:07 PM, Jason Mulligan wrote:
> > Considering
To an extent, I agree… but how would you write a function like jQuery.ajax,
which takes upwards of 30 optional parameters, in a more JavaScripty way?
On Mon, Jun 20, 2011 at 2:07 PM, Jason Mulligan wrote:
> Considering the language, sending an object of args is going against
> the convention of
Considering the language, sending an object of args is going against
the convention of JavaScript due to laziness.
On Jun 17, 12:26 pm, Nick Morgan wrote:
> On 17 June 2011 16:32, Jason Mulligan wrote:
>
> > I prefer sending individual parameters. It's a cross-language
> > convention that works
Meant IE 6-8 still faster then IE 9
--
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 g
IE 6-8 are still faster than IE 8...
--
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
2011/6/18 RobG :
>
>
> On Jun 17, 9:10 pm, xavierm02 wrote:
> [...]
>> Apparently, it's just a bit slower than normal parameters (in the worst case
>> where all paramaters change each time)
>> :http://jsperf.com/parameters-incidence
>
> There is something seriously wrong with those tests - is IE
On Jun 17, 9:10 pm, xavierm02 wrote:
[...]
> Apparently, it's just a bit slower than normal parameters (in the worst case
> where all paramaters change each time) :http://jsperf.com/parameters-incidence
There is something seriously wrong with those tests - is IE 8 really
10,000 times faster tha
I'll definitely second that notion. JavaScript is much different than the
programming languages I've been exposed to. Some great, some bad, but your
coding should reflect that.
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/jsmentors@js
On 17 June 2011 16:32, Jason Mulligan wrote:
> I prefer sending individual parameters. It's a cross-language
> convention that works and is expected.
I think doing stuff in one language because it's what you do in other
languages is a really bad idea - you should be coding with the idioms
of your
I prefer sending individual parameters. It's a cross-language
convention that works and is expected.
--
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-ar
@Xavierm02 I hear you loud and clear. Thanks for putting that test
together. That's a great benchmark and since I'm targeting IE specifically,
maybe we'll have to take this into consideration.
@Dmitry Pashkevich - I like that approach very much. Code that is easy to
maintain always wins. Th
RobG says:
> This seems like classic premature optimisation. Passing an object
> should use more memory because an object is created whose properties
> will be accessed and probably assigned to local variables anyway. But
> I expect that the difference in memory use is absolutely minimal.
>
I agr
And of course there is always a compromise solution: use several formal
parameters and a config object at the same time:
function doSomething(param1, param2, config) {
// do something...
}
In this example* param1* and *param2* are 'main' arguments (normally they
are required) and *config* is an o
I'm not an expert but as far as I know there may also be performance concern
that may affect your decision.
If you write a performance-critical code and you know that a particular
function will be called in a loop (consider a renderer function for items
inside some data view) then it's better t
30 matches
Mail list logo