Benx Blog

六月 15, 2007

Diigo Diary 06/14/2007

Filed under: Diigo Diary — benxshen @ 8:34 上午

EclipseZone – Singleton pattern implementation in 4 …

    Groovy – Groovy Categories  Annotated

      There are many situations where you might find that it would be useful if a class not under your control had additional methods that you define. In order to enable this capability, Groovy implements a feature borrowed from Objective-C , called Categories.
      • 原來,Categories 的設計概念,是從 Objective-C 借用過來的一個特性。雖然我還不是非常清楚 Category 真正的作用,但看起來可以幫助程式開發更簡易喔! – post by benxshen
      import groovy.xml.*

      def html = DOMBuilder.newInstance().html {
      head {
      title (class:’mytitle’, ‘Test’)
      }
      body {
      p (class:’mystyle’, ‘This is a test.’)
      }
      }

      use (groovy.xml.dom.DOMCategory.class) {
      assert html.head.title.text() == ‘Test’
      assert html.body.p.text() == ‘This is a test.’
      assert html.find{ it.tagName == ‘body’ }.tagName == ‘body’
      assert html.getElementsByTagName(‘*’).grep{ it.’@class’ }.size() == 2
      }

      • 這裡是一個範例,可以看到透過 DOMCategory 的協助,xml dom 元素的存取直接可以用 “expression" 的方式就可以很方便地取用,而不需要很囉唆地 getElement() 或之類的 – post by benxshen

      Groovy – User Guide  Annotated

      • Groovy way to implement interfaces
        • GPath
            Groovy Categories
              Regular Expressions
                Scoping and the Semantics of “def"

                  Initialization on demand holder idiom – Wikipedia, the free encyclopedia  Annotated

                  public class Something
                  {
                  private Something()
                  {
                  }

                  private static class LazyHolder
                  {
                  private static final Something something = new Something();
                  }

                  public static Something getInstance()
                  {
                  return LazyHolder.something;
                  }
                  }

                  • Singleton pattern 終極解法! – post by benxshen

                  Object Oriented Design and Programming – Software Design Principles and Design Patterns – Home

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

                      本文以 JavaScript 語言為例,介紹了無類面向對象語言中實現各種面向對象概念的方法。

                        腾讯科技频道 IT业界|互联网|电信|人物|科学

                          网易探索·科学 探索新世界

                            汉典 zdic.net

                              發表迴響 »

                              仍無迴響。

                              RSS feed for comments on this post. TrackBack URI

                              發表迴響

                              在下方填入你的資料或按右方圖示以社群網站登入:

                              WordPress.com Logo

                              You are commenting using your WordPress.com account. Log Out / 變更 )

                              Twitter picture

                              You are commenting using your Twitter account. Log Out / 變更 )

                              Facebook照片

                              You are commenting using your Facebook account. Log Out / 變更 )

                              Google+ photo

                              You are commenting using your Google+ account. Log Out / 變更 )

                              連結到 %s

                              在 WordPress.com 建立免費網站或網誌.

                              %d 位部落客按了讚: