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


Groups > comp.lang.javascript > #15301

Trying to start a new blog series on JS design patterns. Would love some feedback.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Rob Dodson <lets.email.rob@gmail.com>
Newsgroups comp.lang.javascript
Subject Trying to start a new blog series on JS design patterns. Would love some feedback.
Date Thu, 9 Aug 2012 10:30:45 -0700 (PDT)
Organization http://groups.google.com
Lines 27
Message-ID <68e4226f-1d21-44bf-b59b-2e1cd2adfd39@googlegroups.com> (permalink)
NNTP-Posting-Host 69.181.47.33
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1344533446 12211 127.0.0.1 (9 Aug 2012 17:30:46 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 9 Aug 2012 17:30:46 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.181.47.33; posting-account=DEyt6goAAABq7gAK1lZt0L1OgjnO0Xdt
User-Agent G2/1.0
X-Received-Bytes 2613
Xref csiph.com comp.lang.javascript:15301

Show key headers only | View raw


I shared my first few posts on freenode's #javascript channel and got some great responses. They told me to post to comp.lang.javascript for some better (and harsher) feedback.

TOC: http://robdodson.me/blog/2012/08/03/javascript-design-patterns/
Strategy: http://robdodson.me/blog/2012/08/03/javascript-design-patterns-strategy/
Singleton: http://robdodson.me/blog/2012/08/08/javascript-design-patterns-singleton/

The primary feedback so far has been that my examples are too contrived and don't take full advantage of the functional nature of JavaScript. The 'Movement' example in my Strategy post is particularly egregious. A user on IRC mentioned that it should return a function otherwise it's just a "clumsy closure." I'm not sure how to rewrite it to be satisfactory though and I'd love some input on that. I want to learn! 

I know that many people hate design patterns for a number of well justified reasons. With JavaScript being so "nimble" many of the patterns that are necessary in Java aren't as useful when you consider that functions are first class citizens. Also patterns are overused and dangerous in the wrong hands. I chose this topic because (I think) it will force me to confront the differences between the classical languages that I'm used to and the functional/prototype approach in JavaScript. Already I'm *struggling* to write these articles and that's a good thing because I'm forced to dig deeper into the language than I normally would.  So thanks to anyone who takes the time to read my stuff and respond, I deeply appreciate it.

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


Thread

Trying to start a new blog series on JS design patterns. Would love some feedback. Rob Dodson <lets.email.rob@gmail.com> - 2012-08-09 10:30 -0700

csiph-web