??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩午夜av,精品在线小视频,欧美日韩国产在线播放网站http://www.aygfsteel.com/pesome/category/2497.htmlzh-cnTue, 27 Feb 2007 12:04:33 GMTTue, 27 Feb 2007 12:04:33 GMT60AOP之我?/title><link>http://www.aygfsteel.com/pesome/archive/2005/08/10/9717.html</link><dc:creator>pesome</dc:creator><author>pesome</author><pubDate>Wed, 10 Aug 2005 05:59:00 GMT</pubDate><guid>http://www.aygfsteel.com/pesome/archive/2005/08/10/9717.html</guid><wfw:comment>http://www.aygfsteel.com/pesome/comments/9717.html</wfw:comment><comments>http://www.aygfsteel.com/pesome/archive/2005/08/10/9717.html#Feedback</comments><slash:comments>9</slash:comments><wfw:commentRss>http://www.aygfsteel.com/pesome/comments/commentRss/9717.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/pesome/services/trackbacks/9717.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q来研究</SPAN><SPAN lang=EN-US>AOP,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在了解其实现?/SPAN><SPAN lang=EN-US>AspectJ</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>Spring</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">{之?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也多了些思烦</SPAN><SPAN lang=EN-US>.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">早晨一觉醒?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">觉_气爽</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">再看旉q早</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就w床上闭目养?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而思维此时却象q的野?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">U|驰骋</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不知不觉想到我所从事和钟q软g上来</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">忽发奇想</SPAN><SPAN lang=EN-US>:</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其实软g的最l目标就是模拟真实世?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">甚至q一步说是创造世?/SPAN><SPAN lang=EN-US>(</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">看过</SPAN><SPAN lang=EN-US>Matrix</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的朋友应该能理解</SPAN><SPAN lang=EN-US>).</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所?/SPAN><SPAN lang=EN-US>OOP,AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或今后将出现的什么新的Y件思想也都只是q一q程中的浪p已</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而他们的出现及发?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就是ؓ了更好的模拟我们的生z?/SPAN><SPAN lang=EN-US>.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">       </SPAN>OOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的出C所以被UCؓ一个很大的H破</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正因为它很大E度上符合世界的构成</SPAN><SPAN lang=EN-US>.java</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN> <SPAN lang=EN-US>“Everything is object?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之说</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正是有了</SPAN><SPAN lang=EN-US>Object</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q个有利的武?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使得我们在用</SPAN><SPAN lang=EN-US>OOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">表现世界的某些方面时能够得心应手</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但我们世界除?/SPAN><SPAN lang=EN-US>Object</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q有很多其它的东?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比如道d</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">法律</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">规范</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">规律</SPAN><SPAN lang=EN-US>…?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的出现正是模拟这些方?/SPAN><SPAN lang=EN-US>. </SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">       </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以我们最熟悉的对?/SPAN><SPAN lang=EN-US>?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作ؓ考察的对?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">人做为对象由多个对象l成</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如手Q眼</SPAN><SPAN lang=EN-US>…?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们作ؓ世界的个?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">首先守很多规律的制约</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如万有引力定?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">牛顿三大定律</SPAN><SPAN lang=EN-US>…?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q些规律是无处不在的</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">M人都无法去避免或改变</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q有法律</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q是Zؓ拟定的对某些个体hU束性的规范</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果相应个体q法</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则会受到法律的制?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意q里?/SPAN><SPAN lang=EN-US>?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">某些个体</SPAN><SPAN lang=EN-US>?</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">各国的法律只在本国范围内有效</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不同的法律又有不同的受众</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q样对个体而言</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你就受到某些法律的约?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你知道法律可以决定去遵守或违背它</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而你不知?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">法律也是客观存在</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你不去违?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可能Ҏ感受不到?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而在你即使毫不知情的情况下违背时</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它也会显C它的威?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">至于如道h规范{?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其强制性不如法?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但就与个体的怺关系而言其实与法律完全一?/SPAN><SPAN lang=EN-US>.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">       </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果从程序的角度来实C面的怺关系</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">仅用</SPAN><SPAN lang=EN-US>OOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的思想</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃非常的困?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">先说q些定律</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">他们无时不在</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">无处不在</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只是看什么定律对你当前的行ؓ有媄?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如你要上上网</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">听听?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可能感受不到万有引力定律和牛定律的存在</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而你要从</SPAN><SPAN lang=EN-US>12</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">层的楼往下蟩试试</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">万有引力定律和牛定律直接决定了你的生死</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用程序实C上网</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">听听歌或跌楼都可做?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你听歌可以计对而的震动量</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">音乐对你经的刺Ȁ?/SPAN><SPAN lang=EN-US>;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上网可以计算你颈部僵时间的长短</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">计算你网上</SPAN><SPAN lang=EN-US>mm</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的兴奋度</SPAN><SPAN lang=EN-US>;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">x则根据万有引力定律计你坠地时的速度和对w体触地部位的冲?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在这些行Z</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">人是同一个h</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就是同一个对?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只是行ؓ不同</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">也就是方法不?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">那执行不同的Ҏ时要遵@不同的定?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果?/SPAN><SPAN lang=EN-US>OO</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的思想我们把定律抽象ؓ对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则定律v作用是定律对象的方法被调用</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">同一?/SPAN><SPAN lang=EN-US>?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在调用不同的Ҏ?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要明什么定律v主要作用</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">必要把相应定律接口申明到自己Ҏ体中?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q样Ş成了耦合</SPAN><SPAN lang=EN-US>!</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当然使用</SPAN><SPAN lang=EN-US>Design Pattern</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能将q种耦合变成松耦合</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如?/SPAN><SPAN lang=EN-US>Observer</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但即使这样也会有很多的问?/SPAN><SPAN lang=EN-US>:</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果同时多个定律起作?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或定律v作用有先后顺?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或这些定律没法Ş成一个统一的父cL?/SPAN><SPAN lang=EN-US>…?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q有</SPAN><SPAN lang=EN-US>observer</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模式其实也是d的模?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它依赖于对象要主?/SPAN><SPAN lang=EN-US>notify</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q些</SPAN><SPAN lang=EN-US>observer.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">更有意思的?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果一只鸡或一只鸭从楼上掉下去</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它也要遵守万有引力定律和牛顿定律</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而且计算方式与h完全一?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果?/SPAN><SPAN lang=EN-US>OOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的思想</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一是用?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">定义一个父c?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由它实现高处落下时的逻辑</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q样子类可以自动获得这些逻辑</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但这样势必将因ؓ影响行ؓ的定律的复杂?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而带来类层次的复杂?/SPAN><SPAN lang=EN-US>;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二是使用代理</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">东西由高处落下就交给一?/SPAN><SPAN lang=EN-US>delegate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象d?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而这样需要多种</SPAN><SPAN lang=EN-US>delegate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每用一?/SPAN><SPAN lang=EN-US>delegate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">意味着当前对象耦合了一?/SPAN><SPAN lang=EN-US>delegate</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l果对象的耦合性越来越?/SPAN><SPAN lang=EN-US>.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">那么换个角度?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果真有一个上?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它监控着所有的对象</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只要某一个对象从高处落下</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它就把万有引力定律和牛顿定律用到q个对象w上</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而不这个对象是否知道这两个定律</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q样对象与这两个定律完全解耦合</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它只做自己的事</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比如一个h从窗台蟩下去</SPAN><SPAN lang=EN-US>, </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">万有引力定律和牛定律也起作?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但他没有什么损?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">接着骑辆R上街M</SPAN><SPAN lang=EN-US>…?/SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上街是这个h的主要目?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">跳窗C许是为图一时方?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下次他也许就不蟩?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但只要他跳了</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">得׃帝用万有引力定律和牛定律计一?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果H台很高</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">计算l果或许是他骨折了</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只能w医院去</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q个上帝是自然规律</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们可能感觉不到它的存在</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但它实在那?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只要条g被触?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它就会v作用</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不依赖于M个体</SPAN><SPAN lang=EN-US>.</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正是q个上帝在程序世界的体现</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一?/SPAN><SPAN lang=EN-US>Aspect</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一条定律或规范及其执行{略</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Ҏ适定律而言</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">他对所有系l中的对象v作用</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而一些法?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比如未成qh法就只对未成qh起作?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一些规定比如R辆经q收费站要收?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">却对公R无效</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一?/SPAN><SPAN lang=EN-US>Aspect</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>pointcut</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">qD些定律或法律或规定v作用的条?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它能定对象的范?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象的行?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q将一些特权阶U?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Ҏ行ؓ剔除出去</SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US>advice</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是他们的执行了</SPAN><SPAN lang=EN-US>.<BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">    ?/SPAN><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的具体语?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我不x?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">大家很容易找到资?/SPAN><SPAN lang=EN-US>.</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我希望的是能有很多的谈自己对</SPAN><SPAN lang=EN-US>AOP</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的认?/SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我的观点也许也很片面</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">希望通过讨论更加的完?/SPAN><SPAN lang=EN-US>.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><img src ="http://www.aygfsteel.com/pesome/aggbug/9717.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/pesome/" target="_blank">pesome</a> 2005-08-10 13:59 <a href="http://www.aygfsteel.com/pesome/archive/2005/08/10/9717.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AspectJ初探http://www.aygfsteel.com/pesome/archive/2005/08/03/9148.htmlpesomepesomeWed, 03 Aug 2005 11:00:00 GMThttp://www.aygfsteel.com/pesome/archive/2005/08/03/9148.htmlhttp://www.aygfsteel.com/pesome/comments/9148.htmlhttp://www.aygfsteel.com/pesome/archive/2005/08/03/9148.html#Feedback2http://www.aygfsteel.com/pesome/comments/commentRss/9148.htmlhttp://www.aygfsteel.com/pesome/services/trackbacks/9148.html早晨收到IBM developerWorks的邮Ӟ看看有啥值得x的东东。看到篇关于AOP的介l,大致读了一下,文章倒没什么新意,是介绍AOP在项目中的应用,如何化log机制{?/SPAN>

我对AOP也有些了解,主要研究qSpring中AOP实现使用的Dynamic Proxy机制Q对于pointcut和advice也有些概c但也仅此而已Q没有实际写q一行AOP的代码,更不用说在项目中使用AOP了。点了点文章末尾的链接,q入了AOP的世界,看看AOP的几U不同实玎ͼ以及对其的比较文章,倒引起了我对AspectJ的兴。ƈ非其它实现如AspectWerkzQJBoss4.0或Spring不如AspectJQ它们各有侧重,但我对AspectJ的静态检查和较好的IDE集成性(有eclipse3.0的插件ajdtQ比较好奇。于是网上down了个ajdtQ下载urlQhttp://www.eclipse.org/ajdt/Q,开始了对AspectJ的探索之旅?/SPAN>

Ajdt的安装和其它eclipse插g完全一P解压Q拷贝到相应目录Q重启eclipseOK了。进入eclipseQ发现多了个按钮Q有AJ字样Q点d弹出创徏AspectJ目的窗口。先别着急,再查看window->preferences发现多了AspectJ和Visualiser栏目Q随便点点,也不用做什么更改,p认AJDT已经成功的集成进来了?/FONT>

新徏?SPAN lang=EN-US>AspectJ目Q项目名叫myaspect吧。在Package Explorer 中展开新项目,发现除了jre外它自己加入了一个AspectJ的libQ这是AspectJ的类库了Q下面是一个叫build.ajproperties的文Ӟ肯定是配|文件了Q但具体配什么我也没太多,希望马上能写段代码看到AOP的威力了Q倒就因ؓq个后面郁闷好久Q这是后话!

写点什么代码呢Q初ơ用,当然是越单越好,但我?SPAN lang=EN-US>AspectJ的语法一H不通啊。想到网上搜索,又觉得不pȝQ而且大部分文章都是讲AspectJ的好处,讲到具体使用却很。正郁闷时看到eclipse的help菜单Q想惌不定有帮助。打开help content,果然多了AspectJ Language Guide?A title="AspectJ Development User Guide" href="about:blank">AspectJ Development User Guide目录。这其实有点Z我的意外Qeclipse插g我也装了不少Q如tomcatQlomboz{,但都没有帮助文档的,看来AJDT是考虑的周刎ͼq也大大增加了我对AspectJ的好感,得好好研I研IӞ文档当然都是英文Q但q可难不倒俺Q当E序员的英文其它水^不行Q说到“读”那却肯定没问题的。浏览了下这些helpQ找了篇Getting Started的Basic tutorialp着做了Q新建项目,新徏个叫Hello的类Q代码很,是打印“Hello”?/SPAN>

 

1public static void main(String[] args) {
2     sayHello();
3}
 
4
5public static void sayHello() {
6     System.out.print("Hello");
7}
 

 

然后新徏?/FONT>aspectQ叫World吧,代码也很单,拯q去先:

1public aspect World 
2     pointcut greeting() : execution(*Hello.sayHello(..)); 
3
4     after() returning() : greeting() 
5         System.out.println(" World!"); 
6     }
 
7
8}

 

AspectJ语法我不懂,但英文还认识Qpointcut是切点的意思,q段代码估计是在执行Hello.sayHelloҎ后,打印一个“World!”,??.是啥意思我׃大了解了。先急着看效果,我就q行HellocMQ当然我按照文档做,要run as AspectJ/Java application。运行结果:“Hello”。咋不对呢,N我写错了Q先删除代码Q这ơ不拯了,自己手写。还真认识pointcutQafterq些关键字,会高亮显C,Ҏ边就报错Q打全了函数好了,q跟java的静态检查完全一样嘛。试着删除*Q报错,删除..Q好像没事,删除returning()Q好像也没事Q我q纯_Ҏ盲h摸象嘛!呵呵Q没办法Q我p性格。倒也增加了几分对了解其语法的渴望。但现在我还不看Q第一ơ运行,q个象样的结果还没出来啊Q这不是打击我积极性吗Q手工输入了一遍,没错误了Q运行。。。靠Q还是老样子,q什么Getting Started啊,我心中暗骂。仔l在看看文档Q好像也没问题啊Q但它说的那个Cross References昄好像和我不一P看来是我的问题。出师不利啊Q?/FONT>

我可没那么容易放弃,再来一遍,反正单,几分钟又好了Q但l果q是一栗我郁闷啊!失意中我瞎点点,打开了那?SPAN lang=EN-US>property文gQ还是图形化的呢。诶Q好像那个World.aj没勾上,N因ؓq个Q仔l看看说明,included files…对了,AspectJ的特性就是需要用自己的acj~译器进行编译,q可能就是编译的cd表。勾上,保存文gQ果然开始编译,q行。。。结果ؓQ“Hello World!”成功了Q哈哈,q可是俺的第一个AOP成功案例啊!兴奋中想起AspectJ要用自己的编译器~译Q编译出来是.class文gQ但肯定往里面加了些东ѝ于是到eclipse的workspace中找~译出来的class文gQ双L开Q嘿嘿!俺有颖Q自动反~译Q,q就是经AspectJ~译后的HellocM码,原来加了行语句?/SPAN>

1    public static void sayHello()
2
3    {        System.out.print("Hello");       
                   World.aspectOf().ajc$afterReturning$helloworld_World$
1$f69f5afa();
4
5         }

6

World.aj也编译成了World.classQ代码较长:

 1package helloworld;
 2
 3import java.io.PrintStream;
 4
 5import org.aspectj.lang.NoAspectBoundException;
 6
 7public class World
 8
 9{
10
11    private static Throwable ajc$initFailureCause;
12
13    public static final World ajc$perSingletonInstance;
14
15    public World()
16
17    {
18
19    }

20
21    public void ajc$afterReturning$helloworld_World$1$f69f5afa()
22
23    {
24
25        System.out.println("World!");
26
27    }

28
29    public static World aspectOf()
30
31    {
32
33        if(ajc$perSingletonInstance == null)
34
35            throw new NoAspectBoundException("helloworld_World", ajc$initFailureCause);
36
37        else
38
39            return ajc$perSingletonInstance;
40
41    }

42
43    public static boolean hasAspect()
44
45    {
46
47        return ajc$perSingletonInstance != null;
48
49    }

50
51    private static void ajc$postClinit()
52
53    {
54
55        ajc$perSingletonInstance = new World();
56
57    }

58
59    static 
60
61    {
62
63        try
64
65        {
66
67            ajc$postClinit();
68
69        }

70
71        catch(Throwable throwable)
72
73        {
74
75            ajc$initFailureCause = throwable;
76
77        }

78
79    }

80
81}

82

研究一下:也就是生成个默认构造函数的Worldc,加了个ajc$afterReturning$helloworld_World$1$f69f5afa()ҎQ其它好像都是AspectJ生成的class必带的代码,定义了一个public static final World ajc$perSingletonInstance的类Q还有一个private static Throwable ajc$initFailureCause异常Qpublic static World aspectOf()和public static boolean hasAspect()会被自动调用。这是AspectJ能运行的原理了,当然q有更复杂的东西Q但从这个最单的例子也能了解些端倪了??xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

接下来就是学习它的语法了Q其实也不难Q我奇怪网上把AspectJ的学习曲U说的多陡峭Q比java隑֤)Q也是pointcut和adviceQ各自有各自的一些关键字。我也对开始瞎试,有的报错Q有的不报错的原因有了理论的认识了?o:p>

整个探烦的时间也不长Q?SPAN lang=EN-US>1个小时左叻I比我写这东西少多了Q呵呵!打字打的累啊Q回L星际去!看哪天有I,接着研究Q也一定写文章,估计也还有h看的Q呵呵!



pesome 2005-08-03 19:00 发表评论
]]>
վ֩ģ壺 | | ƺ| ֦| | | ɽ| Ǩ| ɽ| »| | | | | | ɽ| | ʹ| ǰ| | ƽ| ľ| | | | | | Ϫ| | | ʯ| ¡| ƽ| | | ɽ| غ| Դ| | | Ȫ|