面朝大海,春暖花開

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            12 Posts :: 1 Stories :: 3 Comments :: 0 Trackbacks

          2006年4月27日 #

          馬上要做新項目了,項目不大,準備用ajax來練練手,HOHO!
          posted @ 2006-06-05 22:09 面朝大海 閱讀(162) | 評論 (0)編輯 收藏

          今天在網(wǎng)上閑逛,發(fā)現(xiàn)了一本好書,關(guān)于JAVA和TDD的,內(nèi)容介紹如下:

          Master Java 5.0 and TDD Together: Build More Robust, Professional Software

          Master Java 5.0, object-oriented design, and Test-Driven Development (TDD) by learning them together. Agile Java weaves all three into a single coherent approach to building professional, robust software systems. Jeff Langr shows exactly how Java and TDD integrate throughout the entire development lifecycle, helping you leverage today's fastest, most efficient development techniques from the very outset.

          Langr writes for every programmer, even those with little or no experience with Java, object-oriented development, or agile methods. He shows how to translate oral requirements into practical tests, and then how to use those tests to create reliable, high-performance Java code that solves real problems. Agile Java doesn't just teach the core features of the Java language: it presents coded test examples for each of them. This TDD-centered approach doesn't just lead to better code: it provides powerful feedback that will help you learn Java far more rapidly. The use of TDD as a learning mechanism is a landmark departure from conventional teaching techniques.

          • Presents an expert overview of TDD and agile programming techniques from the Java developer's perspective

          • Brings together practical best practices for Java, TDD, and OO design

          • Walks through setting up Java 5.0 and writing your first program

          • Covers all the basics, including strings, packages, and more

          • Simplifies object-oriented concepts, including classes, interfaces, polymorphism, and inheritance

          • Contains detailed chapters on exceptions and logging, math, I/O, reflection, multithreading, and Swing

          • Offers seamlessly-integrated explanations of Java 5.0's key innovations, from generics to annotations

          • Shows how TDD impacts system design, and vice versa

          • Complements any agile or traditional methodology, including Extreme Programming (XP)


          E文不算太難,一般都應該可以看懂,為什么好書都是老外寫的呢?
          我想把書傳上來,但是.Text對文件的大小好象是有限制,書的名字叫
          Agile Java Crafting Code with Test-Driven Development,想要的同學可以留下EMAIL

          posted @ 2006-05-12 19:17 面朝大海 閱讀(440) | 評論 (2)編輯 收藏

          很早就聽說過Castle的大名了,但是一直沒有時間去研究。一方面也是自己的惰性,另一方面也關(guān)于Castle的分析文章太少了。但是不管怎么說,面對這這么優(yōu)秀的項目沒有一睹芳容,真是。現(xiàn)在好了,在博客園找到了一個關(guān)于Castle的系列文章,先收藏個連接,51在休息的空隙,還可以抽出點時間好好研究好東東,
          http://www.cnblogs.com/Terrylee/archive/2006/04/28/387503.html
          posted @ 2006-04-28 22:04 面朝大海 閱讀(269) | 評論 (0)編輯 收藏

          近來很忙,一直沒寫 blog 了,今天晚上有點時間,聽了節(jié) MSDN 上面的一節(jié) webCast ,講的就是 Proxy 模式,本就就是這節(jié)課的筆記。

          學習設計模式也有段時間了,很早也見過 Proxy 模式的,記得最開始接觸 Proxy 模式還是在著名的 JIVE 論壇( JIVE 中用 Proxy 來做權(quán)限控制)。今天算是一遍復習吧。

          對復雜的軟件系統(tǒng),人們常常用的一種處理手法是在系統(tǒng)增加一層間接層,得到對系統(tǒng)靈活的、滿足特殊要求的解決方案。

          使用 Proxy 模式的動機:在 OO 的開發(fā)過程中,某些對象的開銷很大(如: new 的開銷大、某些對象因為安全的原因不能被客戶直接的調(diào)用等),如果直接操作這些對象會破壞系統(tǒng)結(jié)構(gòu)。那么,我們就用代理對象來控制對象的訪問。

          例子,?? 一個常見的 HR 系統(tǒng):

          using ?System;

          class ?Employee
          {
          ????
          public ? double ?GetSalary()
          ????
          {
          ????????..
          ????}

          ????
          public ? void ?Report()
          ????
          {
          ????????.
          ????}

          ????
          public ? void ?ApplyVacation()
          ????
          {
          ????????
          ????}

          }


          class ?HrSys
          {
          ????
          public ? void ?ProcessEmployee
          ????????(Employee?employee
          /* 該對象和HR系統(tǒng)在同一個地址空間中 */ )
          ????
          {
          ????????employee.Report();
          ????????..
          ????????employee.ApplyVacation();
          ????}

          }

          現(xiàn)在要求把 Employee 做成 webService HR 系統(tǒng)通過 webService 來調(diào)用 Employee 對象,代碼修改如下:

          using ?System;

          interface ?IEmployee
          {
          ????
          public ? double ?GetSalary();
          ????
          public ? void ?Report();
          ????
          public ? void ?ApplyVacation();
          }

          // 運行在internet上面的某臺機器
          class ?Employee?:?IEmployee
          {
          ????
          public ? double ?GetSalary()
          ????
          {
          ????????..
          ????}

          ????
          public ? void ?Report()
          ????
          {
          ????????.
          ????}

          ????
          public ? void ?ApplyVacation()
          ????
          {
          ????????
          ????}

          }

          // 運行在本地的程序中
          class ?EmployeeProxy?:?IEmployee
          {
          ????
          public ? double ?GetSalary()
          ????
          {
          ????????
          // 對對象創(chuàng)建/訪問的SOAP封裝
          ????
          ?????
          // 發(fā)送SOAP數(shù)據(jù)
          ????
          ?????
          // 如果有返回值,就對SOAP分析,得到C#數(shù)據(jù)
          ????}

          ????
          ????
          public ? void ?Report()
          ????
          {
          ????????
          // 對對象創(chuàng)建/訪問的SOAP封裝
          ????
          ?????
          // 發(fā)送SOAP數(shù)據(jù)
          ????
          ?????
          // 如果有返回值,就對SOAP分析,得到C#數(shù)據(jù)
          ????}

          ????
          ????
          public ? void ?ApplyVacation()
          ????
          {
          ????????
          // 對對象創(chuàng)建/訪問的SOAP封裝
          ????
          ?????
          // 發(fā)送SOAP數(shù)據(jù)
          ????
          ?????
          // 如果有返回值,就對SOAP分析,得到C#數(shù)據(jù)
          ????}

          }

          class ?HrSys
          {
          ????
          public ? void ?ProcessEmployee(IEmployee?employeeProxy)
          ????
          {
          ????????employeeProxy.Report();
          ????????..
          ????????employeeProxy.ApplyVacation();
          ????}

          }

          Proxy 使用的要點:

          1 、“增加一層間接層”,是軟件系統(tǒng)中常用的手段之一。

          2 、具體的實現(xiàn)中, Proxy 有很大差別,有的是簡單的“ copy-on-write ”,有的是對組件模塊的抽象代理。在 JAVA 中常見的 SSH 架構(gòu)模式中( struts+spring+hibernate )中,我們可以把 spring 所在的服務層看成對 hiberate 的代理。

          具體的實現(xiàn)可以參考 .NET 中的 WebService 的實現(xiàn)。

          Copy-on-write 技術(shù)

          class ?App
          {
          ????
          // 系統(tǒng)在內(nèi)存中其實是指向同一塊內(nèi)存
          ???? string ?s1? = ? " Hello " ;? // 不可在修改
          ???? string ?s2? = ? " Hello " ;? // 不可在修改

          ????
          // s1.ToUpper();? // s1不會產(chǎn)生任何改變

          ????stringBulider?sb1?
          = ? new ?stringBulider( " Hello " );
          ????stringBulider?sb2?
          = ? new ?stringBulider( " Hello " );
          ????
          ????sb1.replace(
          " H " , " L " );? // 可以修改成功
          }

          sb1.replace("H","L"); 系統(tǒng)做的動作是, sb1 的代理對象先拷貝 ”Hello” 字符串,然后用“ L ”替換“ H ”, sb1 的代理對象重新指向新的對象。

          posted @ 2006-04-27 20:33 面朝大海 閱讀(300) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 双江| 广灵县| 五指山市| 罗城| 东山县| 镇安县| 德州市| 钟山县| 葵青区| 顺义区| 赣州市| 华亭县| 云林县| 保亭| 定日县| 阿合奇县| 本溪市| 吕梁市| 乐亭县| 阿克苏市| 新和县| 安塞县| 巴东县| 沂源县| 乌审旗| 荔浦县| 南投市| 湖北省| 鹤岗市| 叶城县| 宁安市| 湟中县| 涡阳县| 类乌齐县| 木兰县| 商丘市| 新宾| 鸡泽县| 阳信县| 越西县| 板桥市|