W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2013

Re: [web-audio-api] (NodeCreation): Node creation syntax (#224)

From: Olivier Thereaux <notifications@github.com>
Date: Wed, 11 Sep 2013 07:30:29 -0700
To: WebAudio/web-audio-api <web-audio-api@noreply.github.com>
Message-ID: <WebAudio/web-audio-api/issues/224/24244878@github.com>
> [Original comment](https://www.w3.org/Bugs/Public/show_bug.cgi?id=17408#2) by Robert O'Callahan (Mozilla) on W3C Bugzilla. Fri, 08 Jun 2012 09:43:28 GMT

(In reply to [comment #2](#issuecomment-24244872))
> It seems like this provoked roc to blog:
> http://robert.ocallahan.org/2012/05/canvas-getcontext-mistake.html

That is germane, but it isn't what provoked me to blog...

> However, MediaStream Processing's createProcessor looks like it's repeating the
> "getContext() mistake":
> https://dvcs.w3.org/hg/audio/raw-file/tip/streams/StreamProcessing.html#mediastream-extensions

Oops. Hoist by my own petard!

> That being said, I'm having a hard time forming a strong opinion on this issue.

I stand by my blog post.

(In reply to comment #0)
> A common way is to use a single method taking a string argument giving the
> object name and an optional parameter object for object-specific parameters.
> Examples: document.createElement() and canvas.getContext().
> While semantically similar, using a single create* method is probably
> preferable over many different create* methods (e.g less namespace pollution,
> clearer extensibility mechanism and more consistent with other Web interfaces).

document.createElement() is different because there's an infinite number of different HTML elements you can create, so a finite number of create methods can't work.

Also, "document" and especially "window" are such large and generic interfaces that adding dozens of new methods to them is undesirable. Canvas elements and AudioContexts don't have that problem.

Reply to this email directly or view it on GitHub:
Received on Wednesday, 11 September 2013 14:31:01 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:24 UTC