Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31747

Re: Limit number of function parameters (was:Why does savepng workl with eventlistener but not by call from form?)

Path csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: Limit number of function parameters (was:Why does savepng workl with eventlistener but not by call from form?)
Date Mon, 28 Nov 2016 18:17:55 +0100
Organization solani.org
Lines 44
Message-ID <o1hora$93u$1@solani.org> (permalink)
References <58b433c6-37a6-45de-bc70-05ec835510ff@googlegroups.com> <bfa1965d-1bf2-4024-86e3-ce7535870d2b@googlegroups.com> <17n7y8md13g1b$.kznrbim03ls$.dlg@40tude.net> <2828265.aV6nBDHxoP@PointedEars.de> <o1ctld$g60$1@dont-email.me> <4504999.NdOOCcYCMV@PointedEars.de> <o1d4q7$c90$1@solani.org> <1768059.oMNUckLgyt@PointedEars.de> <o1dblq$pr$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1480353451 9342 eJwFwYEBwDAEBMCVEP5jHDT2H6F3caAYOgIeG3vpA+p68PUrkVy5R4GG2bS3LWGs0i8yXX8ObxB1 (28 Nov 2016 17:17:31 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 28 Nov 2016 17:17:31 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0
Cancel-Lock sha1:6vEN6Xj9e/F2tsITFZWX68GBoaI=
X-NNTP-Posting-Host eJwFwYERACEIA7CV5GgLP46o3X+ET5gKnYIo0HRkjVUzXw+z6403sVAKx5HoAtSDzruA9wMUwxCG
X-User-ID eJwNy8cBwCAMA8CVcJFMxqFY+49A7n8IGk8lwYQglsvLz0CEad/2ld80eaIWOKQ2za3b/+k+DxFVEWs=
In-Reply-To <o1dblq$pr$1@dont-email.me>
Xref csiph.com comp.lang.javascript:31747

Show key headers only | View raw


On 27.11.2016 at 02:08, Scott Sauyet wrote:

> Thomas 'PointedEars' Lahn wrote:
>
>> Christoph M. Becker wrote:
>>
>>> Thomas 'PointedEars' Lahn wrote:
>>>
>>>> Scott Sauyet wrote:
>>>>
>>>>> Why five?  That still seems far too many for almost every case. 
>>>>> Three seems to me a much better guideline.  Of course everyone will
>>>>> draw these lines differently for themselves, but I was wondering: do
>>>>> you have a specific reason for that number?
>>>>
>>>> Yes.
>>>
>>> Which is?
>>
>> [Explanation why Thomas prefers at most 5 function parameters.]

Thanks!

> Of course this is not a serious disagreement.  Clearly the main rule is 
> to limit one's parameter list as well as one can.  But I'm always curious 
> as to how people decide upon their particular limits.

FWIW, I quite like Robert C. Martin's rule regarding function
arguments[1] (even though I don't always follow it):

| The ideal number of arguments for a function is zero (niladic). Next
| comes one (monadic), followed closely by two (dyadic). Three arguments
| (triadic) should be avoided where possible. More than three
| (polyadic) requires very special justification and then shouldnt be
| used anyway.

This rule is given in an OOP context, so for functional or procedural
style most likely one should be added (niladic functional or procedural
functions rarely make sense).

[1] Clean Code: A Handbook of Agile Software Craftsmanship

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why does savepng workl with eventlistener but not by call from form? jonas.thornvall@gmail.com - 2016-11-10 14:35 -0800
  Re: Why does savepng workl with eventlistener but not by call from form? jonas.thornvall@gmail.com - 2016-11-10 15:47 -0800
    Re: Why does savepng workl with eventlistener but not by call from form? JJ <jj4public@vfemail.net> - 2016-11-11 21:05 +0700
      Re: Why does savepng workl with eventlistener but not by call from form? jonas.thornvall@gmail.com - 2016-11-11 06:35 -0800
        Re: Why does savepng workl with eventlistener but not by call from form? JJ <jj4public@vfemail.net> - 2016-11-11 22:01 +0700
          Re: Why does savepng workl with eventlistener but not by call from form? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-11 16:21 +0100
      Re: Why does savepng workl with eventlistener but not by call from form? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-11 16:08 +0100
        Re: Why does savepng workl with eventlistener but not by call from form? Scott Sauyet <scott@sauyet.com> - 2016-11-26 21:09 +0000
          Re: Why does savepng workl with eventlistener but not by call from form? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-26 22:47 +0100
            Re: Why does savepng workl with eventlistener but not by call from form? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-11-27 00:11 +0100
              Re: Why does savepng workl with eventlistener but not by call from form? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-11-27 00:57 +0100
                Re: Why does savepng workl with eventlistener but not by call from form? Scott Sauyet <scott@sauyet.com> - 2016-11-27 01:08 +0000
                Re: Limit number of function parameters (was:Why does savepng workl with eventlistener but not by call from form?) "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-11-28 18:17 +0100
                Re: Limit number of function parameters (was:Why does savepng workl with eventlistener but not by call from form?) Scott Sauyet <scott@sauyet.com> - 2016-11-29 02:15 +0000
                Re: Limit number of function parameters "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-12-02 20:24 +0100
                Re: Limit number of function parameters Scott Sauyet <scott@sauyet.com> - 2016-12-03 01:58 +0000

csiph-web