te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>Advanced JavaScriptJQuery Design Patterns - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Advanced JavaScriptJQuery Design Patterns - Stack Overflow

programmeradmin4浏览0评论

What are the best resources on Design Patterns catering specifically to web development with JavaScript and JQuery?

I'm particularly interested in information on programming my own libraries, reusable ponents, widgets, etc. and the merits of various techniques (for instance in the case of ponents/widgets paring those employed in jQuery UI vs. rolling your own).

I'm also curious about the intricacies of JavaScript as a programming language, and the finer points of object-based programming with JavaScript.

Big fan of Douglas Crockford and the Yahoo video series. Looking for additional examples.

What are the best resources on Design Patterns catering specifically to web development with JavaScript and JQuery?

I'm particularly interested in information on programming my own libraries, reusable ponents, widgets, etc. and the merits of various techniques (for instance in the case of ponents/widgets paring those employed in jQuery UI vs. rolling your own).

I'm also curious about the intricacies of JavaScript as a programming language, and the finer points of object-based programming with JavaScript.

Big fan of Douglas Crockford and the Yahoo video series. Looking for additional examples.

Share Improve this question edited Feb 25, 2010 at 17:04 Pointy 414k62 gold badges594 silver badges626 bronze badges asked Feb 25, 2010 at 17:04 jverdijverdi 1,50613 silver badges14 bronze badges 2
  • This could provoke a silly flame war so it might get closed; tagged as "subjective" to stave that off, possibly. – Pointy Commented Feb 25, 2010 at 17:05
  • 1 I'd say get one of John Resig's books (Pro JS techniques and Secrets of a JS Ninja). He wrote JQuery. He addresses techniques for developers interested in creating their own libraries. Douglas Crockford also has a small (but condensed) book titled "Javascript: the good parts". It's dedicated to js the language, not the DOM. He makes some remendations as to which techniques to adopt and which other to thoroughly avoid (the bad parts). – Michael Ekoka Commented Feb 28, 2010 at 19:45
Add a ment  | 

4 Answers 4

Reset to default 6

One very instructional thing you might do is read over the jQuery source code. It's a treasure-trove of interesting and efficient coding techniques. You might then broaden your horizons by reading over the source for Prototype or some other library.

The nice thing about reading good code and trying to understand it is that it's really real; it is the good code, so you bypass a layer of rhetoric.

Similar to Pointy's answer, you should take a look at these two videos, which help you understand the source code of JQuery (it might be difficult for some to dive into the code from start to finish):

  • 10 things I learned from the jquery source
  • 11 more things I learned from the jquery source

Paul Irish, a member of the JQuery team, goes through some very interesting design patterns in the JQuery source in a humorous way. I think he picks some really interesting spots, which really gives you a lot of usable knowledge you can use elsewhere.

It's probably the resource that has given me the most knowledge about a particular field in the shortest time. It's just really valuable.

This guy has some really good stuff as far as the "intricacies of JavaScript as a programming language" part of your question is concerned:

http://devlicio.us/blogs/sergio_pereira/default.aspx

e.g. http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/javascript-5-ways-to-call-a-function.aspx

The p.lang.javascript group on Usenet is an excellent resource: pretty much everything related to browser scripting has been discussed there and is available in the archive, and some of the regulars, while not always the most polite, are incredibly knowledgeable.

发布评论

评论列表(0)

  1. 暂无评论