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

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

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

    gr8vyguy@Blogjava

    Groovy讀書(shū)筆記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
        像寫(xiě)作文學(xué)小說(shuō)一樣寫(xiě)程序

    a smooth transition

    a seamless mix-and-match of Groovy and Java

    Grais is the Groovy web application framework.
        最值得學(xué)習(xí)的Groovy框架

    Chapter 1

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

    James Strachan inventer of Groovy
        在Internet Cafe學(xué)習(xí)Python的時(shí)候,產(chǎn)生了為Java Platform引進(jìn)類(lèi)似Python的動(dòng)態(tài)語(yǔ)言特性

    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:
       帶括號(hào)的是method call
       不帶括號(hào)的為command call, command call只有在參數(shù)極其簡(jiǎn)單的時(shí)候用,比如參數(shù)里出現(xiàn)(), []
            比如println (1..10).getClass().getName() 容易讓人誤解。

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

    assert是一個(gè)keyword, 而不是Groovy加到j(luò)ava.lang.Object的一個(gè)method, 所以
       assert (1..10).size() == 11不像command一樣有問(wèn)題

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

    def keyword means "dynamically typed".
        沒(méi)有def,沒(méi)有type是指environment binding variables,是global的

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

    GroovyBean: Class with Property, Groovy簡(jiǎn)化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增加新類(lèi),而且為己存在的類(lèi)增加新的功能。
        為己存在的類(lèi)增加新的功能是怎么實(shí)現(xiàn)的?
               關(guān)鍵是MetaClass, Groovy Code里所有的Method Call都要都MetaClass.invokeMethod處理。

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

              這肯定會(huì)影響Groovy程序的效率,不知道groovyc優(yōu)化的效果怎么樣? groovyc只是compile time的事情,
              無(wú)法獲得runtime的信息,更會(huì)減少優(yōu)化的機(jī)會(huì),如果有JVM來(lái)做的話(huà),優(yōu)化的機(jī)會(huì)應(yīng)該更多一些。

    evaluate(code)

    posted on 2007-12-10 12:16 gr8vyguy 閱讀(919) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Java

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

    導(dǎo)航

    統(tǒng)計(jì)

    公告

  • 轉(zhuǎn)載請(qǐng)注明出處.
  • msn: gr8vyguy at live.com
  • 常用鏈接

    留言簿(9)

    隨筆分類(lèi)(68)

    隨筆檔案(80)

    文章分類(lèi)(1)

    My Open Source Projects

    搜索

    積分與排名

    最新評(píng)論

    主站蜘蛛池模板: 69式互添免费视频| 久久亚洲美女精品国产精品| 99久久国产热无码精品免费| ww在线观视频免费观看w| 亚洲熟妇无码av另类vr影视| 国产成人亚洲综合色影视| 亚洲av日韩av欧v在线天堂| 久久这里只有精品国产免费10| 男女作爱在线播放免费网站| 日本免费精品一区二区三区| 国产婷婷综合丁香亚洲欧洲| 日韩精品亚洲人成在线观看| 亚洲中文无韩国r级电影| 国产成人无码a区在线观看视频免费 | 亚洲精品无码久久久久APP| 亚洲无删减国产精品一区| 亚洲精品国产精品乱码不卡√| 免费人成在线观看网站视频| 啦啦啦高清视频在线观看免费| h视频在线免费看| 精品熟女少妇av免费久久| 久久久久久影院久久久久免费精品国产小说 | 国产免费福利体检区久久| 免费国产黄网站在线看| 亚洲日韩在线中文字幕综合| 丁香婷婷亚洲六月综合色| 亚洲中字慕日产2020| 亚洲国产精品无码久久久| 久久精品亚洲精品国产色婷 | 国产免费内射又粗又爽密桃视频 | 尤物永久免费AV无码网站| 免费网站看v片在线香蕉| 天天摸天天碰成人免费视频| 无码中文字幕av免费放| 拨牐拨牐x8免费| 在线免费观看一区二区三区| 热久久精品免费视频| 国产成人高清精品免费软件 | 国产免费高清69式视频在线观看| 久久九九久精品国产免费直播| 国产黄片不卡免费|