W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

Re: [whatwg] [Notifications] Constructor should not have side effects

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 29 Jan 2013 09:44:45 -0600
Message-ID: <CABirCh-vL1+49G0Rr_7sa68iy6BYRoAtgYTYjV2yVcPaZTQ+Hg@mail.gmail.com>
To: Charles McCathie Nevile <chaals@yandex-team.ru>
Cc: WHATWG <whatwg@whatwg.org>, olli@pettay.fi, Elliott Sprehn <esprehn@gmail.com>
On Tue, Jan 29, 2013 at 7:36 AM, Charles McCathie Nevile <
chaals@yandex-team.ru> wrote:

> Really? This doesn't seem like a good idea, so I'd be interested to know
> why. Is there an explanation laid out somewhere?
>

Just to ask from another perspective: why doesn't it seem like a good idea?

Having objects that begin their job when constructed simply avoids an extra
step for the user (telling it to start), and reduces the number of possible
states (eg. eliminating the UNSENT state), which generally simplifies
things.  Supporting reuse of objects is generally not a useful optimization
(in my experience), so not supporting it also simplifies things a bit.
 Reducing the number of different-but-equivalent ways of doing the same
thing is also generally good API design.

-- 
Glenn Maynard
Received on Tuesday, 29 January 2013 15:45:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT