Skip to main content

Home/ InfokeyDEV/ Group items tagged *精華*

Rss Feed Group items tagged

Benx Shen

/* Position Is Everything */ - Modern browser bugs explained in detail! - 1 views

Benx Shen

A re-introduction to JavaScript - MDC - 1 views

  • var name = o && o.getName();
  • var name = otherName || "default";
  • The first argument to apply() is the object that should be treated as 'this'.
  • ...9 more annotations...
  • apply() has a sister function named call, which again lets you set 'this' but takes an expanded argument list as opposed to an array.
  • Closures
  • A closure is the combination of a function and the scope object in which it was created. Closures let you save state - as such, they can often be used in place of objects.
  • An unfortunate side effect of closures is that they make it trivially easy to leak memory in Internet Explorer.
  • The above code sets up the element to turn red when it is clicked. It also creates a memory leak. Why? Because the reference to el is inadvertently caught in the closure created for the anonymous inner function. This creates a circular reference between a JavaScript object (the function) and a native object (el).
  • delete el;
  • var clickHandler = function() { this.style.backgroundColor = 'red'; } (function() { var el = document.getElementById('el'); el.onclick = clickHandler; })();
  • Surprisingly, one trick for breaking circular references introduced by a closure is to add another closure:
  • It's useful to start with an idea of the language's history. JavaScript was created in 1995 by Brendan Eich, an engineer at Netscape, and first released with Netscape 2 early in 1996. It was originally going to be called LiveScript, but was renamed in an ill-fated marketing decision to try to capitalise on the popularity of Sun Microsystem's Java language — despite the two having very little in common. This has been a source of confusion ever since.
  •  
    Chinese new year animals horoscope2016 Happy Chinese new year 2016 messages & quotes Happy new year 2016 greetings for Chinese Chinese new year 2016 funny poems
  •  
    Chinese new year animals horoscope2016
    Happy Chinese new year 2016 messages & quotes
    Happy new year 2016 greetings for Chinese
    Chinese new year 2016 funny poems
Benx Shen

嵌入式Tomcat怎麼能讓Context自動reload-Tomcat-Java - 0 views

Benx Shen

胡侃:面向对象思想的进化-FP-综合技术 -JavaEye做最棒的软件开发交流社区 - 0 views

  • 面向對象編程思想的提出已經不是幾年而是幾十年了,考查其思想的變化,一方面是對現有語言的一些評判,另一方面,也算是對前輩計算機科學家的緬懷。 ——題記 Kristen Nygaard在1962年發明的 Simula 語言現在被認同為世界上第一種明確實現面向對象編程中某些"必要"元素(比如 class)的語言。Simula 是從 Algol 發展來的,可以說,是一種增加了 class 這個數據類型的 Algol,並將參數傳遞的默認模式從"按名調用"換成了"按引用調用",還提出了根據類型確定初始化過程的方法。 從 Simula 的時代開始,科學家們在解決軟件複雜度方面的思路開始"異常開闊"——當然也有資深的老派牛人們不這麼認為。比方說 Peter Norvig,寫了Design Patterns in Dynamic Programming一書來反駁。他認為設計模式早已體現在以 Lisp 為首的一批語言中了,根本不需要什麼面向對象。但我還是跟從偶像 Alan Kay 的觀點。某些時候,把一種特定的編程風格做進語言裡也是必要的。
Benx Shen

無類語言的OOP(JavaScript描述)-FP-綜合技術 -JavaEye做最棒的軟件開發交流社區 - 0 views

  • 本文以 JavaScript 語言為例,介紹了無類面向對象語言中實現各種面向對象概念的方法。
  • 無類語言的OOP(JavaScript描述)
Benx Shen

框架為我所用,勿為框架所困 - 0 views

  • 我們已經被框架所包圍,我們已陷入了學習之苦。
  • 由於長期接受中國式教育,所以我們已經習慣了學習,學習幾個框架,對於國人來說也不是什麼大不了的事情,然而我們也發現,相對於我們的學習能力而言,我們的創造性顯得有些不足,我們有了繼承他人的能力,我們也缺乏一種顛覆他人的精神。
‹ Previous 21 - 26 of 26
Showing 20 items per page