<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gr8vyguy@Blogjava

    Groovy讀書筆記1

    Groovy in Action
        -- DIERK KÖNIG

    Source code is a means of communication: from you to the compiler, to other team members, and then back to you.
    There is both a technical and a human aspect in this communication.

    reveal the programmer’s intent in the code as clearly as possible

    Literate Programming
        像寫作文學小說一樣寫程序

    a smooth transition

    a seamless mix-and-match of Groovy and Java

    Grais is the Groovy web application framework.
        最值得學習的Groovy框架

    Chapter 1

    Groovy will build on your existing experience and familiarity with the Java platform.

    James Strachan inventer of Groovy
        在Internet Cafe學習Python的時候,產生了為Java Platform引進類似Python的動態語言特性

    Groovy’s aims
       feature rich and Java friendly

    Groovy is implemented in Java and Groovy itself.

    Agility and Dynamik

    DSL: domain specific language

    Part 1

    Chapter 2

    #! shebang
        first line comment, to find groovy interpreter

    GLS: Groovy Language Specification

    Optional parentheses:
       帶括號的是method call
       不帶括號的為command call, command call只有在參數極其簡單的時候用,比如參數里出現(), []
            比如println (1..10).getClass().getName() 容易讓人誤解。

    Groovy自動import
        groovy.lang.*
        groovy.util.*
        java.lang.*   (Java已經import)
        java.util.*
        java.net.*
        java.io.*
        java.math.BigInteger和java.math.BigDecimal

    assert是一個keyword, 而不是Groovy加到java.lang.Object的一個method, 所以
       assert (1..10).size() == 11不像command一樣有問題

    ==
      測試equality,而不是identity, 即
      x == y 等同于Java的 x.equals(y), Java中的x == y在Groovy中為x.is(y)

    def keyword means "dynamically typed".
        沒有def,沒有type是指environment binding variables,是global的

    groovy File.groovy
        File.groovy必須是一個Script,a class with main method, a Runnable或者a GroovyTestCase

    GroovyBean: Class with Property, Groovy簡化JavaBean
        1. Generating the accessor methods, default visibility => define property, generate get/set(if non final)
        2. Simplified access to all Bean(JavaBean and GroovyBean)    Bean.property
        3. Simplified registration of event handlers

    GString with "
        GString is not subclass of String, No class can be subclass from String , because String is final.

    Numbers are objects, not primitive type

    Subscript Operator [ ]

    Ranges
        1..10, subclass of List

    Groovy Class Loader
         load class from *.groovy transparently

    AST: Abstract Syntax Tree

    GDK不僅為JDK增加新類,而且為己存在的類增加新的功能。
        為己存在的類增加新的功能是怎么實現的?
               關鍵是MetaClass, Groovy Code里所有的Method Call都要都MetaClass.invokeMethod處理。

              this.foo()     generated as(simplified)
                      this.getMetaClass().invokeMethod(this, "foo", EMPTY_PARAMS_ARRAY)

              這肯定會影響Groovy程序的效率,不知道groovyc優化的效果怎么樣? groovyc只是compile time的事情,
              無法獲得runtime的信息,更會減少優化的機會,如果有JVM來做的話,優化的機會應該更多一些。

    evaluate(code)

    posted on 2007-12-10 12:16 gr8vyguy 閱讀(904) 評論(0)  編輯  收藏 所屬分類: Java

    <2007年12月>
    2526272829301
    2345678
    9101112131415
    16171819202122
    23242526272829
    303112345

    導航

    統計

    公告

  • 轉載請注明出處.
  • msn: gr8vyguy at live.com
  • 常用鏈接

    留言簿(9)

    隨筆分類(68)

    隨筆檔案(80)

    文章分類(1)

    My Open Source Projects

    搜索

    積分與排名

    最新評論

    主站蜘蛛池模板: 精品日韩亚洲AV无码一区二区三区 | 国产精品成人亚洲| 亚洲精品无码成人片在线观看 | 国产一区视频在线免费观看| 精品久久久久久亚洲中文字幕 | 亚洲爆乳无码专区| 久久福利青草精品资源站免费 | 亚洲狠狠婷婷综合久久久久| 中文字幕免费人成乱码中国| 国产国拍亚洲精品mv在线观看| 久久久久久AV无码免费网站| 亚洲精品动漫在线| 无人在线直播免费观看| 亚洲一本到无码av中文字幕| 在线jyzzjyzz免费视频| 看全免费的一级毛片| 国产AⅤ无码专区亚洲AV| 久久青草免费91线频观看站街| 亚洲黄网站wwwwww| 久久久久免费看黄A片APP| 久久久久久亚洲精品无码| 亚洲一区二区三区无码影院| 免费国产叼嘿视频大全网站 | mm1313亚洲国产精品美女| 亚洲图片一区二区| 野花高清在线观看免费完整版中文| 亚洲中文无码永久免费| 亚洲伊人成无码综合网 | 精品亚洲国产成人av| 亚洲精品无码av人在线观看| 亚洲人成免费网站| 美女被羞羞网站免费下载| 国产∨亚洲V天堂无码久久久| 免费观看激色视频网站bd| 免费在线观看亚洲| 日韩亚洲Av人人夜夜澡人人爽| 免费视频中文字幕| 免费观看91视频| 国产精品亚洲va在线观看| 久久丫精品国产亚洲av不卡| 免费大片在线观看网站|