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: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Why does savepng workl with eventlistener but not by call from form? Date: Sun, 27 Nov 2016 00:57:39 +0100 Organization: PointedEars Software (PES) Lines: 53 Message-ID: <1768059.oMNUckLgyt@PointedEars.de> References: <58b433c6-37a6-45de-bc70-05ec835510ff@googlegroups.com> <17n7y8md13g1b$.kznrbim03ls$.dlg@40tude.net> <2828265.aV6nBDHxoP@PointedEars.de> <4504999.NdOOCcYCMV@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1480204660 14310 eJwFwYEBwDAEBMCVSJ5nHKL2H6F3dl39EW4OW9uxjXHrlvITPBnAaz4oe2S4t7+kYlKqUuIHHtYRDQ== (26 Nov 2016 23:57:40 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 26 Nov 2016 23:57:40 +0000 (UTC) User-Agent: KNode/4.14.2 Cancel-Lock: sha1:Q+gjbjJ2RhWMPADZNNMWgvDlILY= X-User-ID: eJwNyckBwDAIA7CV6oBNGCcH7D9C85Vogk64KGezG5qVqQB57popxDh0q30fqHoPdKYHrtxrfY6ytIH9avMHSBgVdg== X-NNTP-Posting-Host: eJwFwYEBwDAEBMCVqCeM8yH2H6F3bqHRB+EBX1+hxn2589gknucpEc0pMXRATK1u8xMf4+AHJqwRGA== Xref: csiph.com comp.lang.javascript:31745 Christoph M. Becker wrote: > On 26.11.2016 at 22:47, Thomas 'PointedEars' Lahn wrote: >> Scott Sauyet wrote: >>> Thomas 'PointedEars' Lahn wrote: >>>> Lesson to be learned: Design functions/methods to accept references to >>>> parameter/option objects, and not more than 5 arguments [unless it is a >>>> list of values of equal meaning, see e.g. Math.max()]. Otherwise >>>> nobody is going to remember the correct argument order, you will be >>>> sacrificing flexibility, [ ... ] >>> 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? Maybe it was like Douglas Adams picked the number that was going to be the “Answer to the Ultimate Question of Life, The Universe, and Everything”: “The answer to this is very simple. It was a joke. It had to be a number, an ordinary, smallish number, and I chose that one. Binary representations, base thirteen, Tibetan monks are all complete nonsense. I sat at my desk, stared into the garden and thought '42 will do'. I typed it out. End of story.” —Douglas Adams in , So, why did I pick 5? It just seemed practical at the time, and it still does. It is a reasonably small number, which is important for a short code line length, particularly if you want to be descriptive in your parameter names, but not so small as to be overly restrictive in a rule of thumb. If you are human(oid), and still equipped with all fingers (or toes), you can count the arguments/parameters of the function on those using only one limb. Maybe it is easier to develop a mnemonic because of that. In hindsight, there is also an oft-cited theory in the cognitive sciences (which I learned of when studying machine-computer interaction) which is usually interpreted so that humans’ working memory can hold up to 7 ± 2 items; so, 5 would be a number that every human(oid) could manage: Finally, I think that I can remember the correct order of 5 parameters without consuming too much caffeine. -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.