<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Five 's Weblog</title>
	<atom:link href="http://powerdream5.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://powerdream5.wordpress.com</link>
	<description>It is not just another blog! 伍行天下！</description>
	<lastBuildDate>Wed, 28 Nov 2007 21:21:29 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='powerdream5.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b83f3cb0955eab114902a009525db137?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Five 's Weblog</title>
		<link>http://powerdream5.wordpress.com</link>
	</image>
			<item>
		<title>Whose mistake?</title>
		<link>http://powerdream5.wordpress.com/2007/11/28/whose-mistake/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/28/whose-mistake/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 21:21:29 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[Company]]></category>
		<category><![CDATA[University]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/28/whose-mistake/</guid>
		<description><![CDATA[        I will graduate in this December, and now looking for a job. To be honest, I really want to be a J2EE programmer.  Actually, I have had several interviews with some companies. It doesn&#8217;t matter whether I finally get a job, but I have strong feeling that what we learned in the university are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=121&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_26_1_2007.jpg" title="11_26_1_2007.jpg"></a>        I will graduate in this December, and now looking for a job. To be honest, I really want to be a J2EE programmer.  Actually, I have had several interviews with some companies. It doesn&#8217;t matter whether I finally get a job, but I have strong feeling that what we learned in the university are not the same things the company want to get from us. When I studied for my bachelor degree in China, I had already hearded a lot of information about the knowledge we get from the classes are detached from the companies. However, now, when I am studying for the masters&#8217; degree in U.S, I find the same thing happens here as in China.</p>
<p>        For example, Agile Development is so popular in most software companies currently. However, in the university, we almost have no chance of understanding it deeply, perhaps just heard a little bit informaton on it, and it is not necessary to say we cannot apply it to the real projects.</p>
<p>        Whose mistake is this? It is not the professors&#8217; mistake, since they are just responible for giving instructions to students. It is absolutely not the companies&#8217; mistake. They just want to find the right person who can contribute to the companies immediately. It is also not the students&#8217;, expecially the good students&#8217;, mistake. We spend a large part of our time in all kinds of assignments in that we want a high GPA, so that it is impossible for us to concentrate on the things which are becoming the trend.</p>
<p>        In fact, we cannot find the right person who need to be responsible for this problem. What we need to do is finding the reasons caused it and solving this problem. In my opinion, the most important reason is that the purposes of the unversity and the company are different from each other. The universities aim to help the students build solid foundation and form a good learning way, therefore, the students can pick up new things more quickly and effectively in the future. However, the companis hope the new employees can bring their benefits immediately. I think no company would like to invest time and money to the new employees and wait for them to bring profit, which also explains why experience is the most significant factor when somebody is looking for a job. In fact, few days ago, I read an article that some students complain that why the textbooks they use are the ones published 20 years ago, for example, the theory of operating system, which is usually a required course of the computer science department.</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_26_1_2007.jpg" title="11_26_1_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_26_1_2007.jpg" alt="11_26_1_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/121/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/121/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/121/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/121/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/121/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=121&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/28/whose-mistake/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_26_1_2007.jpg" medium="image">
			<media:title type="html">11_26_1_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Shift to Dynamic programming language</title>
		<link>http://powerdream5.wordpress.com/2007/11/24/shift-to-dynamic-programming-language/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/24/shift-to-dynamic-programming-language/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 03:44:55 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[Dynamic Programming Language]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/24/shift-to-dynamic-programming-language/</guid>
		<description><![CDATA[        In recent years, dynamic programming languages develope very fastly, especially PHP and Ruby. There is no doubt that They have already became the first choice for many programmerers when developing web applications. Furthermore, it seems that more and more people, like thoughtworks, are trying to apply them to enterprise applications dominated by Java and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=119&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/sky.jpg" title="sky.jpg"></a>        In recent years, dynamic programming languages develope very fastly, especially PHP and Ruby. There is no doubt that They have already became the first choice for many programmerers when developing web applications. Furthermore, it seems that more and more people, like <a target="_blank" href="http://www.thoughtworks.com/what-we-do/RubyWorks.html">thoughtworks</a>, are trying to apply them to enterprise applications dominated by Java and C#.</p>
<p>        I have studied JAVA for almost 5 years. I love it. Everything in JAVA makes me comfortable. Although I have finished several projects by PHP, and in some aspects, PHP is really better than JAVA, I still put JAVA in the first place in my mind.</p>
<p>       In fact, there are already a lot of arguments about PHP or Ruby on Rails are not suitable for complex enterprise appliactions. In my opinion, everything in the world is changing, so is dynamic programming language. Just like Java adopts some good features of dynamic language, for example, reflection and supporting scripting language, I believe that both PHP and Ruby on Rails are developing so that they can be applied in a broader area.</p>
<p>        Now, I have a strong feeling that it is necessary to pay more attention to Ruby and Ruby on Rails. Many Java programers think that studying dynamic languages can imporve their thought about Java. Therefore, it is killing two birds with one stone.</p>
<p>        Fortunately, because I have much experience in Java, it is easy to pick up a kind of dynamic language. However, I suggest the people who want to study programming start from Java or C++, since they are more religious and can help you build solid fundation in programming.</p>
<p align="center"><a href="http://powerdream5.files.wordpress.com/2007/11/sky.jpg" title="sky.jpg"><img src="http://powerdream5.files.wordpress.com/2007/11/sky.jpg" alt="sky.jpg" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/119/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/119/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=119&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/24/shift-to-dynamic-programming-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/sky.jpg" medium="image">
			<media:title type="html">sky.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>As a Java Programmer, Do you still remember?</title>
		<link>http://powerdream5.wordpress.com/2007/11/20/as-a-java-programmer-do-you-still-remember/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/20/as-a-java-programmer-do-you-still-remember/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 02:31:50 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[initializing]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[static keyword]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/20/as-a-java-programmer-do-you-still-remember/</guid>
		<description><![CDATA[        Today, When I was tidying up the disk space of my hard driver, I found something interesting. It is the notes I made when I started learning Java. In fact, I have already used Java for almost 4 years. However, when I am coding, It seems that many things have already became my habits, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=117&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_20_1_2007.jpg" title="11_20_1_2007.jpg"></a>        Today, When I was tidying up the disk space of my hard driver, I found something interesting. It is the notes I made when I started learning Java. In fact, I have already used Java for almost 4 years. However, when I am coding, It seems that many things have already became my habits, so that I don&#8217;t think about the reason why I do it like that. When reading these notes again, I have a feeling of getting an insight into the problem. Therefore, I suggest all the programmers, not just Java programmer, not always keeping coding, sometimes please stop to think and recall.</p>
<p>        In the following, there are some concepts of Java. They are pretty easy, but do you still remember them?</p>
<p><font color="#ff0000">Default values for primitive members:</font> When a primitive data type is a member of a class, it is guaranteed to get a default value if you do not initialize it. Notice that this guarantee doesn&#8217;t apply to local variables (for example, you declare it in a method), since that are not fields of a class.</p>
<p><font color="#ff0000">The static keyword:</font> When you say something is static, it means that data or method is not tied to any particular object instance of that class, and it directly belongs to the class. Bear in mind that the static method cannot directly access non-static members or methods. There are two ways to refer to a static variable and method. You can name it via an object or refer to it directly through its class name. Usually, we always prefer to the later way.</p>
<p><em><font color="#ff0000">Distinguishing overloaded methods:</font></em> there is a siimple rule. Each overloaded method must take a unique list of argument types. Even differences in the ordering of arguments are sufficient to distinguish two methods. And only the differences of the type of return value cannot separate two methods.</p>
<p><font color="#ff0000">String s = new String(&#8220;a String&#8221;);<br />
</font>this sentence contains four tasks. The first one is creating a String object in the heap; the second one is initializing this String object as &#8220;a String&#8221;; the third one is create a reference named s; then make this reference point to the String object.</p>
<p><font color="#ff0000">what is the sequence of initializing the members of a java class?<br />
</font>Let&#8217;s assume that there is a class named Dog.</p>
<ol>
<li>when we create an object of Dog or the first time to access the static members or methods of Dog, JVM need to find Dog.class firstly</li>
<li>all the static memebers of the Dog class will be initialized</li>
<li>arranging space for the object created by new Dog() in the heap. This space will be cleared and all the memebers of the Dog class will get their default value</li>
<li>run the definition initialization</li>
<li>run the consturctor</li>
</ol>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_20_1_2007.jpg" title="11_20_1_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_20_1_2007.jpg" alt="11_20_1_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/117/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/117/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=117&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/20/as-a-java-programmer-do-you-still-remember/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_20_1_2007.jpg" medium="image">
			<media:title type="html">11_20_1_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>The differences between Decorator Pattern and Proxy Pattern</title>
		<link>http://powerdream5.wordpress.com/2007/11/17/the-differences-between-decorator-pattern-and-proxy-pattern/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/17/the-differences-between-decorator-pattern-and-proxy-pattern/#comments</comments>
		<pubDate>Sun, 18 Nov 2007 01:38:45 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[decorator pattern]]></category>
		<category><![CDATA[proxy pattern]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/17/the-differences-between-decorator-pattern-and-proxy-pattern/</guid>
		<description><![CDATA[       Firstly, Let&#8217;s look at the following two UML diagrams which describes the basic implementation of Decorator Pattern and Proxy Pattern respectively.





        The two UML diagrams may confuse us. The two design patterns looks the same with each other. With Decorator Pattern, the decorator and the decoratee implement the same interfaces. With Proxy PatteRn, the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=115&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" title="11_17_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_3_2007.jpg" title="11_17_3_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" title="11_17_4_2007.jpg"></a>       Firstly, Let&#8217;s look at the following two UML diagrams which describes the basic implementation of Decorator Pattern and Proxy Pattern respectively.</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" title="11_17_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" title="11_17_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" title="11_17_2_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" alt="11_17_2_2007.jpg" /></p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_3_2007.jpg" title="11_17_3_2007.jpg"></a></p>
<p></a></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_17_3_2007.jpg" alt="11_17_3_2007.jpg" /></p>
<p>        The two UML diagrams may confuse us. The two design patterns looks the same with each other. With Decorator Pattern, the decorator and the decoratee implement the same interfaces. With Proxy PatteRn, the proxy class and the real class delegated implement the same interfaces. Furthermore, no matter which pattern is used, it is easy to add functions before or after the method of the real object.        However, in fact, there are some differences between Decorator Pattern and Proxy Pattern. Decorator Pattern focuses on dynamically adding functions to an object, while Proxy Pattern focuses on controlling access to an object. In other words, with Proxy Pattern, the proxy class can hide the detail information of an object from its client. Therefore, when using Proxy Pattern, we usually create an instance of abject inside the proxy class. And when using Decorator Pattern, we typically pass the original object as a parameter to the constructor of the decorator.</p>
<p>       We can use another sentence to conclude thire differences: with the Proxy pattern, the relationship between a proxy and the real subject is typically set at compile time, whereas decorators can be recursively constructed at runtime.</p>
<p><font color="#ff0000">//Proxy Pattern<br />
</font>public class Proxy implements Subject{</p>
<p>       private Subject subject;<br />
       public Proxy(){<br />
            <font color="#ff0000"> //the relationship is set at compile time</font><br />
            subject = new RealSubject();<br />
       }<br />
       public void doAction(){<br />
             &#8230;.<br />
             subject.doAction();<br />
             &#8230;.<br />
       }<br />
}</p>
<p><font color="#ff0000">//client for Proxy</font><br />
public class Client{<br />
        public static void main(String[] args){<br />
             <font color="#ff0000">//the client doesn&#8217;t know the Proxy delegate another object<br />
</font>             Subject subject = new Proxy();<br />
             &#8230;<br />
        }<br />
}<br />
<font color="#ff0000">//Decorator Pattern</font><br />
public class Decorator implements Component{<br />
        private Component component;<br />
        public Decorator(Component component){<br />
            this.component = component<br />
        }<br />
       public void operation(){<br />
            &#8230;.<br />
            component.operation();<br />
            &#8230;.<br />
       }<br />
}</p>
<p><font color="#ff0000">//client for Decorator</font><br />
public class Client{<br />
        public static void main(String[] args){<br />
            <font color="#ff0000">//the client designate which class the decorator decorates</font><br />
            Component component = new Decorator(new ConcreteComponent());<br />
            &#8230;<br />
        }<br />
}</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" title="11_17_4_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" title="11_17_4_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" title="11_17_4_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" alt="11_17_4_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/115/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/115/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=115&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/17/the-differences-between-decorator-pattern-and-proxy-pattern/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_17_2_2007.jpg" medium="image">
			<media:title type="html">11_17_2_2007.jpg</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_17_3_2007.jpg" medium="image">
			<media:title type="html">11_17_3_2007.jpg</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_17_4_2007.jpg" medium="image">
			<media:title type="html">11_17_4_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Command Pattern</title>
		<link>http://powerdream5.wordpress.com/2007/11/14/command-pattern/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/14/command-pattern/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 02:04:13 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[command pattern]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/14/command-pattern/</guid>
		<description><![CDATA[       I am not going to introduce the definition of Command Pattern, as well as the advantage and disadvantage of it. You can find many articles about that on the internet. Here, I just wanna give an example and realiz it by command pattern. (command pattern in wiki)
       There are two cleaner. One is responsible [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=111&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_14_1_2007.jpg" title="11_14_1_2007.jpg"></a>       I am not going to introduce the definition of Command Pattern, as well as the advantage and disadvantage of it. You can find many articles about that on the internet. Here, I just wanna give an example and realiz it by command pattern. (<a href="http://en.wikipedia.org/wiki/Command_pattern">command pattern in wiki</a>)</p>
<p>       <em>There are two cleaner. One is responsible for sweeping the floor, and the other one is responsible for rubbing the table.  However, both of them are lazy. They never do their job until the supervisor commands them.</em></p>
<p>       There is no doubt it is suitable for command pattern to realize this problem. The following is my code:</p>
<p><font color="#ff0000">//the command interface</font><br />
public interface Command{<br />
       public void executeCommand();<br />
}</p>
<p><font color="#ff0000">//concrete command 1<br />
</font>public class RubTableCommand implements Command{<br />
       private Worker worker;<br />
       public RubTableCommand(Worker worker){<br />
             this.worker = worker;<br />
       }</p>
<p>       public void executeCommand(){<br />
            worker.doJob();<br />
       }<br />
}</p>
<p><font color="#ff0000">//concrete command 2</font><br />
public class SweepFloorCommand implements Command{<br />
       private Worker worker;<br />
       public SweepFloorCommand(Worker worker){<br />
             this.worker = worker;<br />
       }</p>
<p>       public void executeCommand(){<br />
             worker.doJob();<br />
       }<br />
}</p>
<p><font color="#ff0000">//the receiver interface</font><br />
public interface Worker{<br />
       public void doJob();<br />
} </p>
<p><font color="#ff0000">//receiver 1</font><br />
public class CleanerForRubTable implements Worker{<br />
 <br />
      public void doJob(){<br />
          System.out.println(&#8220;Rubbing floor&#8221;);<br />
      }<br />
}</p>
<p><font color="#ff0000">//receiver 2</font><br />
public class CleanerForSweepFloor implements Worker{<br />
 <br />
      public void doJob(){<br />
         System.out.println(&#8220;Sweeping floor&#8221;);<br />
      }<br />
}</p>
<p><font color="#ff0000">//the invoker</font><br />
public class InvokeCommand{<br />
       private Command command;</p>
<p>       public void setCommand(Command command){<br />
            this.command = command;<br />
       }</p>
<p>       public void sendCommand(){<br />
            command.executeCommand();<br />
       }<br />
}</p>
<p><font color="#ff0000"> //the client</font><br />
public class Supervisor{<br />
 <br />
       public static void main(String[] args){<br />
             Worker cleanerForSweepFloor = new CleanerForSweepFloor();<br />
             Worker cleanerForRubTable = new CleanerForRubTable();<br />
  <br />
             InvokeCommand ic = new InvokeCommand();<br />
             Command command = new RubTableCommand(cleanerForRubTable);<br />
             ic.setCommand(command);<br />
             ic.sendCommand();</p>
<p>            command = new SweepFloorCommand(cleanerForSweepFloor);<br />
            ic.setCommand(command);<br />
            ic.sendCommand();  <br />
       }<br />
}</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_14_1_2007.jpg" title="11_14_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_14_1_2007.jpg" title="11_14_1_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_14_1_2007.jpg" alt="11_14_1_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/111/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/111/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=111&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/14/command-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_14_1_2007.jpg" medium="image">
			<media:title type="html">11_14_1_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Patterns and Refactoring &#8211; After reading the article &#8220;Patterns &amp; XP&#8221;</title>
		<link>http://powerdream5.wordpress.com/2007/11/12/patterns-and-refactoring-after-reading-the-article-patterns-xp/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/12/patterns-and-refactoring-after-reading-the-article-patterns-xp/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 02:11:35 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[over-engineering]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/12/patterns-and-refactoring-after-reading-the-article-patterns-xp/</guid>
		<description><![CDATA[
   
      The article &#8220;Pattern &#38; XP&#8221; is written by Joshua Kerievsky. The purpose of this article is to figure out how to apply Patterns to the context of Extreme Programming, because he thinks that XP has far focused heavily on Refactoring while remaining all but silent about Patterns, the reason for this is that Patterns encourage [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=109&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" title="11_12_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" title="11_12_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" title="11_12_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" title="11_12_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" title="11_12_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" title="11_12_2_2007.jpg"></a></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" alt="11_12_1_2007.jpg" />   </p>
<p style="text-align:left;">      The article &#8220;<a href="http://www.industriallogic.com/xp/PatternsAndXP.pdf">Pattern &amp; XP</a>&#8221; is written by <a href="http://c2.com/cgi/wiki?JoshuaKerievsky">Joshua Kerievsky</a>. The purpose of this article is to figure out how to apply Patterns to the context of Extreme Programming, because he thinks that XP has far focused heavily on Refactoring while remaining all but silent about Patterns, the reason for this is that Patterns encourage over-engineering, while Refactoring keeps things simple and light.</p>
<p>      The prerequisite of understanding the importance of combining patterns and refactoring is realizing the relationship between them. This article has quoted some words from the Design Patterns Book, which can help to explain it well.</p>
<p>     <em>Our design patterns capture many of the structures that result from refactoring. Using these patterns early in the life of a design prevents later refactorings. But even if you don&#8217;t see how to apply a pattern until after you&#8217;ve built your system, the pattern can still show you how to change it. Design patterns thus provide targets for your refactoring.</em></p>
<p>     However, there are two problems of applying patterns early in the life of a design. The first one is over-engineering, which means that we make great efforts to produce flexible and robust designs early in the life of a system, but we do not realize that all our work will be meaningless and wasteful if the system never needs such degrees of flexibility and robutness. Sometimes, it is not necessary to inject various desgin patterns to our designs. Secondly, there is no 100% perfect design, in order to keep the system in high quality, refactorying is necessary!</p>
<p>     In the other side, without Patterns, refactoring may make small design improvements, but their overall design will ultimately suffer because it lacks the order, simplicity, and effectiveness that come from intelligently using Patterns.</p>
<p>     Herefore, Joshua Kerievsky suggest us that: start simple, think about Patterns but keep them on the back-burner, make small refactorings, and move these refactorings towards a Pattern or Patterns only when there is a genuine need for them.</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" title="11_12_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" title="11_12_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" title="11_12_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" title="11_12_2_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" alt="11_12_2_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/109/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/109/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=109&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/12/patterns-and-refactoring-after-reading-the-article-patterns-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_12_1_2007.jpg" medium="image">
			<media:title type="html">11_12_1_2007.jpg</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_12_2_2007.jpg" medium="image">
			<media:title type="html">11_12_2_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>The process-level cache in Hibernate</title>
		<link>http://powerdream5.wordpress.com/2007/11/11/the-process-level-cache-in-hibernate/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/11/the-process-level-cache-in-hibernate/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 00:03:21 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[ORM]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[process-leve cache]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/11/the-process-level-cache-in-hibernate/</guid>
		<description><![CDATA[
        Hibernate has two kinds of cache, which are the first-level cache and the second-level cache. We also call the first-leve cache session cache, and the second-level cache process-level cache. The first-level cache is mandatory and can&#8217;t be turned off; However, the second-level cache in Hibernate is optional. Because the process-level cache caches objects across [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=106&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="center"><a href="http://powerdream5.files.wordpress.com/2007/11/11_11_2_2007.jpg" title="11_11_2_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_11_1_2007.jpg" title="11_11_1_2007.jpg"><img src="http://powerdream5.files.wordpress.com/2007/11/11_11_1_2007.jpg" alt="11_11_1_2007.jpg" /></a></p>
<p>        Hibernate has two kinds of cache, which are the first-level cache and the second-level cache. We also call the first-leve cache session cache, and the second-level cache process-level cache. The first-level cache is mandatory and can&#8217;t be turned off; However, the second-level cache in Hibernate is optional. Because the process-level cache caches objects across sessions and has process or cluster scope, in some situation, turning on the process-level cache can improve the performance of the application. In fact, before accessing the database to load an object, Hibernate will first look in the Session cache and then in the process-level cache.</p>
<p>       The process-level cache is best used to store objects that change relatively infrequently, and it is set up in two steps. First, you have to decide which concurrency strategy to use. After that, you configure cache expiration and physical cache attribtes using the cache provider. Hibernate supports a variety of caching strategies including:<br />
read-only : which is suitable for objects which never changes. Use if for reference data only.<br />
read-write : which is suitable for objects that are modified by the application.</p>
<p>      To cache these classes in the process-level cache, we must use the &lt;cache&gt; element in the O/R mapping. For example:<br />
&lt;class name=&#8221;?&#8221; talbe=&#8221;?&#8221;&gt;<br />
      <font color="#ff0000">&lt;cache usage=&#8221;read-wirte&#8221; /&gt;<br />
</font>      &#8230;<br />
&lt;/class&gt;</p>
<p>      The usage=&#8221;read-write&#8221; attribute specifies that instances of this class are sometimes updated by the application. One thing needed to remember is that you must enable lazy loading for relationships that are from objects that not cached to objects that are cached to ensure that the applications uses the cache.<br />
&lt;class name=&#8221;?&#8221; talbe=&#8221;?&#8221;&gt;<br />
      &lt;cache usage=&#8221;read-wirte&#8221; /&gt;<br />
       &#8230;</p>
<p>       &lt;set name=&#8221;?&#8221; lazy=&#8221;true&#8221;&gt;<br />
               <font color="#ff0000"> /*collections require their own &lt;cache&gt; element*/</font><br />
               &lt;cache usage=&#8221;read-only&#8221; /&gt;<br />
                &#8230;<br />
        &lt;/set&gt;<br />
&lt;/class&gt;</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_11_2_2007.jpg" title="11_11_2_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_11_2_2007.jpg" alt="11_11_2_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/106/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/106/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=106&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/11/the-process-level-cache-in-hibernate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_11_1_2007.jpg" medium="image">
			<media:title type="html">11_11_1_2007.jpg</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_11_2_2007.jpg" medium="image">
			<media:title type="html">11_11_2_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Eager loading in Hibernate</title>
		<link>http://powerdream5.wordpress.com/2007/11/09/eager-loading-in-hibernate/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/09/eager-loading-in-hibernate/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 21:50:15 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[ORM]]></category>
		<category><![CDATA[eager loading]]></category>
		<category><![CDATA[fetch]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[lazy loading]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/09/eager-loading-in-hibernate/</guid>
		<description><![CDATA[      In default, Hibernate adopts the mechanism of lazy loading to load objects from databases. Lazy loading contributes a lot to improve the performance of an application by limiting the amount of objects that will be needed. In contrast to lazy loading, eager loading loads the full objects tree once. Because eager loads multiple related objects [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=103&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_9_2_2007.jpg" title="11_9_2_2007.jpg"></a>      In default, Hibernate adopts the mechanism of lazy loading to load objects from databases. Lazy loading contributes a lot to improve the performance of an application by limiting the amount of objects that will be needed. In contrast to lazy loading, eager loading loads the full objects tree once. Because eager loads multiple related objects with a single SELECT statement instead of using multiple SELECT statements, therefore in some situations, eager loads can also improve the performance of the application by reducing the times of accessing the database.</p>
<p>     There are two ways to configure eager loading in Hibernate. They are staticly eager loading and dynamically eager loading respectively. If the application always traverses a relationship, you might want to configure it to be always staticly eager loaded. Conversely, you might want to dynamically configure eager loading for relationships that are only traversed by the application when handling particular requests.</p>
<p>     One way to configure static eager loading is specifying a value for the <em>fetch</em> attribute of the relationship&#8217;s mapping element. <br />
     This attribute can have one of two values:<br />
     <strong>select</strong>: Lazily load the referenced object or collection with a separate SQL SELECT statement. It is the default value<br />
     <strong>join</strong>: Eagerly load the referenced object or collection using an outer join</p>
<p>&lt;hibernate-mapping&gt;<br />
     &lt;class name=&#8221;?&#8221; table=&#8221;?&#8221;&gt;<br />
          &lt;many-to-one name=&#8221;?&#8221; <font color="#ff0000">fetch=&#8221;join&#8221;</font> column=&#8221;?&#8221; /&gt;<br />
     &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p>
<p>      To configure dynamical eager loading, you must use queries with fetch joins.<br />
&lt;hibernate-mapping&gt;<br />
      &#8230;<br />
      <font color="#ff0000">&lt;query name=&#8221;queryName&#8221;&gt;<br />
            &lt;![CDATA[<br />
                 from student s<br />
                 left outer join fetch s.classID as c<br />
                 left outer join fetch c.className<br />
                 where s.id = ?<br />
            ]]&gt;<br />
       &lt;/query&gt;<br />
</font>     &#8230;.<br />
&lt;/hibernate-mapping&gt;</p>
<p>     Finally, take a note that Hibernate has a rule that a class can only have at most one collection loaded using an outer join. This is to prevent inefficient queries that return the Cartesian product of too large collections.</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_9_2_2007.jpg" title="11_9_2_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_9_2_2007.jpg" alt="11_9_2_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/103/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/103/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=103&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/09/eager-loading-in-hibernate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_9_2_2007.jpg" medium="image">
			<media:title type="html">11_9_2_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>Transaction Concurrency (2)</title>
		<link>http://powerdream5.wordpress.com/2007/11/07/transaction-concurrency-2/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/07/transaction-concurrency-2/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 03:13:15 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[Five's thought]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[optimistic locking]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/07/transaction-concurrency-2/</guid>
		<description><![CDATA[       As mentioned in the article Transaction Concurrentcy(1), most application choose read committed as the isolation level. The reason is that no matter whether there is concurrency occuring, serializable and repeatable read need to lock the rows in the database, which cause the reduction in the system performance, especially for these system where concurrency doesn&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=100&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_7_1_2007.jpg" title="11_7_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_7_2_2007.jpg" title="11_7_2_2007.jpg"></a>       As mentioned in the article Transaction Concurrentcy(1), most application choose read committed as the isolation level. The reason is that no matter whether there is concurrency occuring, serializable and repeatable read need to lock the rows in the database, which cause the reduction in the system performance, especially for these system where concurrency doesn&#8217;t happen frequently. However, Read committed cannot avert unrepeatable read and Second lost updates problem, therefore, we need to use optimistic locking or pessimistic locking to make up!</p>
<p align="center"><a href="http://powerdream5.files.wordpress.com/2007/11/11_7_1_2007.jpg" title="11_7_1_2007.jpg"><img src="http://powerdream5.files.wordpress.com/2007/11/11_7_1_2007.jpg" alt="11_7_1_2007.jpg" /></a></p>
<p>      Today, I am going to make a brief introduction to optimistic locking. Optimistic locking is based on the assumption that most database transaction don&#8217;t conflict with other transactions. In fact, optimistic locking doesn&#8217;t actually lock anything. Instead, when a transaction updates a row it verifies that the row has not been changed or deleted by a different transaction since it was read. If it has, the transaction is typically rolled back and retried.</p>
<p>     Usually, there are three methods to realize optimistic locking. The first one is adding a version column to the tables in the database. The second one is adding a timestamp column, and the third one is to compare current values of the columns with their previously read values. Commonly, we prefer the vrsion column to the other two methods, since the third method makes the sql sentences too complicated and the second method is not suitable for any case.</p>
<p>     There is a sql sentence using version column:<br />
     Update ACTIVITIES Set PLACE = &#8216;?&#8217; WHERE ACTIVITY_ID=? AND VERSION = ?;</p>
<p>     The following is an simple example to show how to configure optimistic locking realized by version column. It is pretty easy!</p>
<p>&lt;hibernate-mapping&gt;<br />
      &lt;class name=&#8221;**&#8221; table=&#8221;**&#8221;&gt;<br />
              &lt;id name=&#8221;*&#8221; column=&#8221;*&#8221;&gt;<br />
                    &lt;generator class=&#8221;*&#8221; /&gt;<br />
              &lt;/id&gt;<br />
              <font color="#ff9900">&lt;version name=&#8221;version&#8221; column=&#8221;VERSION&#8221; /&gt;<br />
</font>      &lt;/class&gt;<br />
&lt;/hibernate-mapping&gt;</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_7_2_2007.jpg" title="11_7_2_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_7_2_2007.jpg" alt="11_7_2_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/100/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/100/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=100&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/07/transaction-concurrency-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_7_1_2007.jpg" medium="image">
			<media:title type="html">11_7_1_2007.jpg</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_7_2_2007.jpg" medium="image">
			<media:title type="html">11_7_2_2007.jpg</media:title>
		</media:content>
	</item>
		<item>
		<title>My Personal Website</title>
		<link>http://powerdream5.wordpress.com/2007/11/06/my-personal-website/</link>
		<comments>http://powerdream5.wordpress.com/2007/11/06/my-personal-website/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 02:15:36 +0000</pubDate>
		<dc:creator>powerdream5</dc:creator>
				<category><![CDATA[About me]]></category>
		<category><![CDATA[resume]]></category>
		<category><![CDATA[wu cao]]></category>

		<guid isPermaLink="false">http://powerdream5.wordpress.com/2007/11/06/my-personal-website/</guid>
		<description><![CDATA[       I am sorry for I haven&#8217;t update the blog for several days, because I worked on mypersonal website. The good news is that it is finished today, and you can visit it
through this link: http://www2.potsdam.edu/caow190. I used a lot javascript, and tested it in IE and Firefox. Unfortunately, It seems that some javascript code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=98&subd=powerdream5&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://powerdream5.files.wordpress.com/2007/11/11_3_1_2007.jpg" title="11_3_1_2007.jpg"></a>       I am sorry for I haven&#8217;t update the blog for several days, because I worked on mypersonal website. The good news is that it is finished today, and you can visit it<br />
through this link: <a target="_blank" href="http://www2.potsdam.edu/caow190">http://www2.potsdam.edu/caow190</a>. I used a lot javascript, and tested it in IE and Firefox. Unfortunately, It seems that some javascript code do not work  well in Safari. Therefore, please visit it using IE or Firefox. I am pretty sorry for that.</p>
<p>      In my personal website, you can see some works I did in recent years. The works include web development projects, Java program, 2D design works, 3D design works and Flash works. After seeing a lot of designing stuff made by me, you may regard me as a web designer. In fact, I have much more experience in programming than designing, and I set my career orientation as a web application programmer. Designing is just a kind of my interest. No matter what, hope you have fun with it. If you have any question or comment, please contact me!</p>
<p><a href="http://powerdream5.files.wordpress.com/2007/11/11_3_1_2007.jpg" title="11_3_1_2007.jpg"></a><a href="http://powerdream5.files.wordpress.com/2007/11/11_3_1_2007.jpg" title="11_3_1_2007.jpg"></p>
<p style="text-align:center;"><img src="http://powerdream5.files.wordpress.com/2007/11/11_3_1_2007.jpg" alt="11_3_1_2007.jpg" /></p>
<p></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/powerdream5.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/powerdream5.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/powerdream5.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/powerdream5.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/powerdream5.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/powerdream5.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/powerdream5.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/powerdream5.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/powerdream5.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/powerdream5.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/powerdream5.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/powerdream5.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=powerdream5.wordpress.com&blog=1840509&post=98&subd=powerdream5&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://powerdream5.wordpress.com/2007/11/06/my-personal-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a0819a06b6ff4afc4f3e0a1977e6a5a2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">powerdream5</media:title>
		</media:content>

		<media:content url="http://powerdream5.files.wordpress.com/2007/11/11_3_1_2007.jpg" medium="image">
			<media:title type="html">11_3_1_2007.jpg</media:title>
		</media:content>
	</item>
	</channel>
</rss>