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

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 UTC