Bean 的个人资料Anders.Pan的共享空间照片日志列表 工具 帮助

日志


8月25日

中国男篮最后6秒绝杀斯洛文尼亚

今天中国迎战小组赛最后一个对手斯洛文尼亚,中国队必须战胜斯洛文尼亚才可能小组出线。
斯洛文尼亚的队员都是前南斯拉夫队员,身高马大,作风强悍。前三节,中国队一直大比分落后,直到第三节末才把比分最至
相差3分。第四节刚开始,中国队打出了一个小高潮,反超了比分。此后两队进入胶着状态,比分咬得很紧,到了最后时刻
中国队依靠朱芳雨远投3分反超1分,此时还剩下最后48秒钟,斯洛文尼亚进攻,中国队犯规,斯洛文尼亚两分进一,扳平比分。
但此后中国队没把握机会,反倒被斯洛文尼亚反超两分,这个时候还剩下6秒钟。本以为没戏了,后卫刘伟妙传王仕鹏,王接球后迅速
运球到达对方3分线前,此刻只剩2秒钟,王仕鹏果断出手,对方此刻还处于上一个进球的兴奋之中,没人盯防王仕鹏,15号中锋也只是在3
分线内举起双手封堵,但还有一定的距离,只见此球一出,竟神奇地空心入篮,3分命中!而且Timeout!中国队凭借这一记亚哨三分幸运地战胜了斯洛文尼亚队,获取小组第四出线。出线后中国队将迎战希腊队。
8月23日

Great Firewall

互联网在中国实在是太不自由了,最近听说国家搞了个GreatFirewall,专门用来封堵反动言论的,
封堵那些纯粹的反动网站,比如法轮功之流也就无所谓了,但是,连google都要被封,就太sb了。
比如用google搜索江泽民,钓鱼岛等敏感字,就挂了,为何?原因是google并没有过滤其中的反动言论
,也就是说,搜索江泽民的时候,会出来骂江泽民的内容。而国内的“太监”搜索引擎却不会被封,为何
,因为太监嘛,是不会搜索出反动言论的。比如搜索打倒江泽民,太监搜索引擎搜出来的是歌颂江泽民
,然后接一段打倒某某反动派,某某黑社会,实在是太垃圾啦~~
最后,强烈鄙视一下GreatFirewall,缺乏自由的中国互联网,肯定会自我灭亡,中国管互联网那伙人就是一
群大sb!
8月22日

中国男篮果然输了

中国队今天开场打得还算不错,以一波9:0开场,但随后就被迎头追上了,特别是第二节,居然被反超,但中国的
内线实力还是超强的,在第3节末领先6分,第四节一开始又4:0开局,让人重新燃起出线希望,不过随后尤纳斯
的所作所为令我大跌眼镜,这个时候,中国队的士气已经上来了,而且姚明手感超好,打得正起劲之时居然把他给
换下来休息,真是莫名其妙。姚明一下场之后,中国队内线开始土崩瓦解,领先优势霎时间化为乌有,此刻姚明不得不
重新上场,但是此时姚明手已经变冷,哪儿还有刚才的锐气!果然,不出两分钟,姚明不但没什么贡献,反倒被罚下了。
这个时候,群龙无首的中国队肯定会被干掉,只不过是时间问题罢了。不过第四节结束前中国队本有机会干掉波队,但是
中国队把握机会的能力太差了,最后虽然拖进了加时赛,但是没有内线优势的中国队已是三流滥队,输球也就不足为怪啦~~
 

男篮世锦赛前景堪忧

中国男篮太滥了,不但被意大利灭了,还狂输USA 30多分,出线都成问题。赛前竟有媒体预测中国男篮具备拿牌实力,
也许是中国男篮太自大了,导致比赛前就轻敌,姚明在对阵意大利前就夸下海口说灭掉意大利没问题,结果一败涂地。
看了中国队的两场比赛,感觉没有整体,都是单干,看来还是应验了那句老话,一个中国人很nb,但一群中国人就很sb,
还是缺乏团队精神啊~~,另外一个问题就是经不起高强度的逼强,打美国的时候,竟然被逼到连续3次传不出球来,真是无
语了。明天就要打波多黎各了,据说是美国二队,我看是凶多吉少了,希望中国队能打出应有水平吧,goodluck
8月20日

java pitfall

  • 自动类型转换

short a , b, c;

a = 1;

b = 2;

c = a + b;//编译指示这行出错了,possible loss of precision

 

原因:二元操作符(如+、-、*、/)当其操作的对象是基本数据类型时,会把其操作的变量自动提升为至少到int型

 

  • 自动类域扩展

class A {

public void f1() {

System.out.println("A.f1");

}

}

 

class B extends A{

public int f1() { // 重复定义错误,f1()已经在父类A中定义,可以修正为void f1(),覆盖A的同名方法

System.out.println("B.f1");

return 0;

}

 

}

 

public static void main(String arg[]) {

A a = new B();

a.f1(); // 修正后,调用的是Bf1()方法

}

 

  • 判断语句的条件判断表达式的返回结果只接受boolean类型

比如:

Object a = null;

int intValue = 0;

 

if (!a) { // 编译错误

 ...

}

 

while(!intValue); // 编译错误

 

  • try-catch-finally

class A {

public int f1() {

System.out.println("A.f1");

return 2;

}

}

 

class B extends A{

public int f1() {

try {

return 0;

} catch (Exception e) {

// TODO: handle exception

}

finally {

System.out.println("B.f1");

return 1;

}

}

 

public static void main(String arg[]) {

A a = new B();

System.out.println(a.f1());

}

 

结果是:

B.f1

1

 

无论try块中发生了什么,只要不是vm关闭,机器关闭,finally中的语句始终被执行

 

  • 不允许永远不会被执行的语句存在

return;

int a = 1; // 编译错误,该句永远不会被执行

 

改为:

if(true)

return;

 

int a = 1; // 编译通过

 

  • 接口中的数据成员都是static final类型的,方法都是public

public interface test() {

int i = 0; // 被自动转换为static final

}

 

 

 

8月5日

windows选择程序出错

修复方法:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Unknown]
"AlwaysShowExt"=""
"QueryClassStore"=""

[HKEY_CLASSES_ROOT\Unknown\shell]
@="openas"

[HKEY_CLASSES_ROOT\Unknown\shell\openas]

[HKEY_CLASSES_ROOT\Unknown\shell\openas\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,25,00,53,\
00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,\
79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,65,00,6c,00,6c,\
00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,4f,00,70,00,65,00,6e,00,41,00,\
73,00,5f,00,52,00,75,00,6e,00,44,00,4c,00,4c,00,20,00,25,00,31,00,00,00
8月3日

尤文降级

由于电话门丑闻事件,尤文图斯被罚降入乙级,并扣除17分。

意大利当地时间25日晚8时30分,意大利体育法庭做出了意甲电话门的终审判决。首席法官桑杜利宣布,尤文图斯剥夺之前两个赛季意甲冠军头衔,仍然降入乙 级,但罚分从30分大幅度减少到17分。 佛罗伦萨和拉齐奥成功“保级”,不过被扣除的分数则相应增加。AC米兰更是成为大赢家,他们比预想中争取联盟杯资格的目标更进一步,得以重返欧洲冠军杯!


意甲丑闻一审判决结果


四家被指控的俱乐部:

尤文图斯:剥夺2004/05赛季联赛冠军,不授予2005/06赛季联赛冠军。以联赛最后一名降入2006/07赛季乙级联赛,同时在2006/07赛季乙级联赛以负30分开始赛季。

AC米兰:扣除2005/06赛季甲级联赛积分44分,不能参加明年冠军联赛。同时在2006/07赛季甲级联赛以负15分开始赛季;

拉齐奥:以联赛最后一名降入2006/07赛季乙级联赛,同时在2006/07赛季乙级联赛以负7分开始赛季;

佛罗伦萨;以联赛最后一名降入2006/07赛季乙级联赛,同时在2006/07赛季乙级联赛以负12分开始赛季。

26个被指控的个人:

俱乐部官员:前尤文图斯总经理莫吉和前尤文图斯董事长吉拉乌多禁赛5年;AC米兰副主席加利亚尼禁赛1年,前AC米兰经理梅亚尼禁赛3年6个月;佛罗伦萨主席安德雷亚·德拉瓦莱禁赛3年6个月,名誉主席迭戈·德拉瓦莱禁赛4年;拉齐奥主席洛蒂托禁赛3年。

足协官员:前足协主席卡拉罗禁赛4年6个月,前足协副主席马齐尼禁赛5年。

裁判官员:前裁判指定员贝尔加莫司法疑问,前裁判指定员帕伊雷托禁赛2年6个月,前裁判委员会主席拉内塞禁赛2年6个月,前助理裁判指定员马泽伊禁赛1年,裁判观察员因加尔乔拉禁赛1年。

裁判:德桑蒂斯禁赛4年6个月,罗多蒙蒂无罪,东达里尼禁赛3年6个月,贝尔蒂尼无罪,梅西纳无罪,罗基无罪,塔利亚文托无罪,帕帕雷斯塔禁赛3个月,普利西禁赛1个月,巴比尼禁赛1年。


欧洲足联作出最终判决 AC米兰喜获冠军杯参赛资格

北京时间8月2日20时30分,欧足联在瑞士尼翁宣布:经过紧急事务委员会讨论,AC米兰被允许参加本赛季冠军杯,这意味着AC米兰可以出战下周中的冠军杯资格赛第3轮首回合比赛,对手是贝尔格莱德红星或爱尔兰科克队。AC米兰卷入“电话门”,在一审中被取消欧战资格,但二审减轻了处罚,AC米兰最终排名上赛季意甲第三。

Anders Hejlsberg's blog at borland


http://blogs.borland.com/AndersIvner/

Borland

Borland

(Borland Software Corporation, Cupertino, CA, www.borland.com) A software company founded as Borland International in 1983 by Philippe Kahn. The company is noted for its language and development products. It also popularized the desktop accessory for DOS PCs with its Sidekick program. With its Turbo Pascal, Borland moved Pascal out of the academic halls into a commercial product, and its Turbo C became an industry standard for DOS. Borland C++ and Delphi have been widely used for developing Windows applications, and its JBuilder environment for Java is very popular.

The company acquired the Paradox database in 1987 and dBASE in 1991, making it the leader in PC database software in the early 1990s. It later sold Paradox to Corel. In 1995, Kahn resigned as president, but remained as chairman. In 1998, Borland changed its name to Inprise Corporation in recognition of its focus on "integrating the enterprise." In 2001, it changed it back to Borland.

Philippe Kahn
Borland's founder was a notable personality in the early days of personal computing and led the company into some very successful ventures. (Image courtesy of Borland Software Corporation.)

Borland Software Corporation is a software company headquartered in California. NASDAQ: BORL It was founded by Philippe Kahn in 1983. It is best known for its software development tools, especially the Turbo Pascal programming tool that has evolved into today's Delphi. The company also produces application lifecycle management tools and sells consulting and education services.

History

The 1980s: Foundations

The Borland name (but not the company which exists today) started with a small company in Ireland. Three Danish citizens, Niels Jensen, Ole Henriksen, and Mogens Glad founded Borland Ltd. in August 1981 to develop products for the CP/M operating system using the name of an off-the-shelf company.[1] After their products were exhibited at the CP/M-82 show in San Francisco, the company went bankrupt.

The company which would eventually become known as "Borland International," MIT ("Market in Time"), was founded in California in 1982 by Philippe Kahn. MIT had done some consulting work for Borland Ltd. and was owed $7,500. When MIT asked Kahn's company to change it's name, he acquired the rights to the "Borland" name from the bankruptcy court. Kahn took Borland public on the London Stock Exchange in 1986. A secondary stock offering on NASDAQ happened in 1988. The company's personnel then included Philippe Kahn as CEO, Chairman, and President, and Spencer Ozawa as Vice President Operations in the US. Later personnel included Marie Bourget as CFO and Gregor Freund as Director of European Operations.

Borland developed a series of well-regarded software development tools. Their first product was Turbo Pascal, using the compiler developed by Anders Hejlsberg. 1984 saw the launch of SideKick, a time organization, notebook and calculator utility, notable for being a Terminate and Stay Resident (TSR) program.

In 1987 Borland purchased Wizard Systems and incorporated portions of the Wizard C technology into Turbo C. Bob Jarvis, the author of Wizard C became a Borland employee. Turbo C was released on 18 May 1987 and an estimated 100,000 copies were shipped in the first month of its release.

In September 1987 Borland purchased Ansa-Software including their Paradox (version 2.0) database management tool. Richard Schwartz, CEO of Ansa became Borland's CTO.

The Quattro Pro spreadsheet was launched in 1989 with, at the time, a notable improvement and charting capabilities. Lotus development, under the leadership of Jim Manzi sued Borland for copyright infringement. The litigation brought forward Borland's open standards position as opposed to Lotus' closed approach. Borland, under Philippe Kahn's leadership took a position of principle and announced that they would defend against Lotus' legal position and "fight for programmer's rights".[citation needed] After 6 years of litigation Borland's position got validated by the Supreme Court of the United States and Lotus lost the case.

Additionally, Borland was known for its practical and creative approach towards software piracy and intellectual property (IP), introducing its "Borland no-nonsense license agreement." This allowed the developer/user to utilize its products "just like a book"; he or she was allowed to make multiple copies of a program, as long as only one copy was in use at any point in time.

Borland also offered the full source code to many of its products, including editors, spreadsheets, chess games, and database engines.

The 1990s: Rise and change

In September 1991 Borland purchased Ashton-Tate, bringing the dBase and InterBase databases to the house, in an all stock transaction. Competition with Microsoft was fierce. Microsoft used its dominance in opearting systems to shake Borland up. Microsoft launched the competing database Microsoft Access and bought the dBase clone FoxPro in 1992, undercutting Borland's prices. Microsoft was focused on Borland and it must be noted that today Borland is the only company still standing among Microsoft's competitors at that time: Software Publishing, WordPerfect, Lotus and many others are all gone.

During the early 1990s Borland's implementation of [[C++]] was considered superior to then-market-trailing Microsoft. Also, its development of Paradox, with its ObjectPAL programming language, pitted it against software by Microsoft, in particular Access.

By the mid-1990s, Borland fell from dominance in the software tools market. Some people thought that competition from Microsoft was to blame. Microsoft used the same tactics as they did with spreadsheets, word processors, browsers and other software components.

A change in market conditions contributed to Borland's fall from prominence. In the 1980's, companies had few people who understood the growing personal computer phenomenon, and so most technical people were given free rein to purchase whatever software they thought they needed. Borland had done an excellent job marketing to those with a highly technical bent. By the mid-1990's, however, companies were beginning to ask what the return was on the investment they had made in this loosely controlled PC software buying spree. Company executives were starting to ask questions that were hard for technical folks to answer, and so corporate standards began to be created. This required new kinds of marketing and support materials from software vendors, but Borland remained focused on quality and software craftsmanship, which unfortunately seemed to matter less in a changed market. Rival software company Microsoft did a much better job of recognizing the changing market and shipping "adequate" solution that corporations were seeking and edging out Borland using their dominance with operating systems.

In October 1994, Borland sold Quattro Pro to Novell for $140 Million in cash, repositioning the company on its core software development tools.

Philippe Kahn and the Borland board came to a disagreement on how to focus the company, and the Borland board of directors fired Kahn as CEO, President and Chairman of Borland, a position he had held for 12 years, in January 1995.[2] Kahn remained on Borland board until November 7, 1996, when he resigned from that position.[3] Borland named Gary Wetsel as CEO, but he resigned in July 1996. William F. Miller was interim CEO until September of that year, when Whitney G. Lynn became interim president and CEO.

The Delphi 1 rapid application development (RAD) environment was launched in 1995, under the leadership of Anders Hejlsberg.

The Inprise years, and name changes

On November 25, 1996, Del Yocam was hired as Borland CEO and Chairman.

In 1997, Borland sold Paradox to Corel. In November 1997, Borland acquired Visigenic, a middleware company that was focused on implementations of CORBA.

On April 29, 1998, Borland refocused its efforts on targeting enterprise applications development, and went through a name change to Inprise Corporation (the name came from the slogan Integrating the Enterprise). The idea was to integrate Borland's tools, Delphi, [[C++Builder]], and JBuilder with enterprise environment software, including Visigenic's implementations of CORBA, Visibroker for C++ and Java, and the new emerging product, Application Server.

For a number of years (both before and during the Inprise name) Borland suffered from serious financial losses and very poor public image. When the name was changed to Inprise, many thought Borland had gone out of business.

dBase was sold in 1999.

In 1999, in the middle of Borland's identity crisis, Dale L. Fuller replaced CEO Del Yocam. At this time Fuller's title was "interim president and CEO." The "interim" was dropped a few years later.

A proposed merger between Inprise and Corel was announced in February 2000, aimed at producing Linux based products, however the scheme was abandoned when Corel's shares fell and it became clear that there was really no strategic fit.

InterBase 6.0 was made available as an open source product in July 2000.

Borland reborn in name and fame

The Borland name (Borland Software Corporation) replaced Inprise in January 2001. The name Inprise was abandoned.

Under the Borland name and a new management team headed by President and CEO Dale L. Fuller, a now-smaller and profitable Borland refocused on Delphi, and created a version of Delphi and C++Builder for Linux, both under the name Kylix. This brought Borland's expertise in Integrated Development Environments to the Linux platform for the first time. Kylix was launched in 2001.

Plans to spin off the InterBase division as a separate company were abandoned after Borland and the people who were to run the new company could not agree on terms for the separation. With the reenergized division under new management, Borland stopped open source releases of InterBase and has developed and sold new versions at a fast pace.

Borland made a commitment to the technology of web services releasing Delphi 6 as the first Integrated Development Environment to support web services. Now all of their current development platforms support web services.

C#Builder was released in 2003 as a native C# development tool, competing head-on with Visual Studio .NET. As of the 2005 release, C#Builder, Delphi for Win32, and Delphi for .NET have been combined into a single IDE called "Borland Developer Studio" (though the combined IDE is still popularly known as "Delphi"). Supporting web services and now .NET is doing a lot to bolster Borland's image in the industry. With their consistent profitability, in late 2002 Borland purchased design tool vendor TogetherSoft and tool publisher Starbase, makers of the StarTeam configuration management tool and the CaliberRM requirements management tool. The latest releases of JBuilder and Delphi integrate these tools to give developers a broader set of tools for development.

The rounded-out set of product offerings legitimized Borland's new claim to the Application Lifecycle Management (ALM) market, with tools spanning the software development chain from requirements, through design and development, to testing and deployment. In 2004 Borland rolled out its Software Delivery Optimization (SDO) marketing tagline, pitching the idea that SDO encompassed ALM in addition to higher-level software manufacturing concepts like portfolio management and estimation tools.

Former CEO Dale Fuller resigned in July 2005 but remained on the board of directors. Former COO Scott Arnold took the title of interim president and chief executive officer until November 8, 2005, when it was announced that Tod Nielsen would take over as CEO effective November 9, 2005.

In October 2005, Borland acquired Legadero, in order to add its IT Management and Governance (ITM&G) suite, called Tempo, to the Borland product line.

On February 8 2006 Borland announced the divestiture of their IDE division, including Delphi, JBuilder, and InterBase. At the same time they announced the planned acquisition of Segue Software, a maker of software test and quality tools, in order to concentrate on Application Lifecycle Management (ALM).

On March 20 2006 Borland said that it had acquired Gauntlet Systems, a provider of technology that screens software under development for quality and security.

Products

Current products

Borland's current product line includes:

Old software, no longer actively sold

Programming tools
Utilities
Applications

Notes

  1. ^ Intersimone
  2. ^ Kellner, Krey, Jeffers, Parks
  3. ^ Borland press release

References

External links


Orthogonality and the DRY Principle -- 3

Orthogonality and the DRY Principle
A Conversation with Andy Hunt and Dave Thomas, Part II
by Bill Venners
March 10, 2003

<<  Page 3 of 3

Advertisement
&lt;script language="JavaScript" type="text/javascript"&gt; document.write('&lt;a href="http://clk.atdmt.com/XDA/go/rtmsfaml0040000015xda/direct/01/" target="_blank"&gt;&lt;img src="http://view.atdmt.com/XDA/view/rtmsfaml0040000015xda/direct/01/"/&gt;&lt;/a&gt;'); &lt;/script&gt;&lt;noscript&gt;&lt;a href="http://clk.atdmt.com/XDA/go/rtmsfaml0040000015xda/direct/01/" target="_blank"&gt;&lt;img border="0" src="http://view.atdmt.com/XDA/view/rtmsfaml0040000015xda/direct/01/" /&gt;&lt;/a&gt;&lt;/noscript&gt;

Be Orthogonal

Bill Venners: What does orthogonality mean and why is it good?

Andy Hunt: The basic idea of orthogonality is that things that are not related conceptually should not be related in the system. Parts of the architecture that really have nothing to do with the other, such as the database and the UI, should not need to be changed together. A change to one should not cause a change to the other. Unfortunately, we've seen systems throughout our careers where that's not the case.

Dave Thomas: For example, when one client changed the number of lines on the screen, they had to change the database schema too.

Andy Hunt: This is what computer scientists call coupling, one thing is tied—or coupled—to another. There are exceptions and tradeoffs, but in most cases you want to minimize coupling between things that are otherwise unrelated. It is easy in an OO system to accidentally introduce coupling. You can do it just by the way you set up libraries, if you're working in a language like C or C++, where you link things together. If you want to make a little program to test out one API or interface and you have to link in every library in the system, you have too much coupling. Your system is not orthogonal.

Orthogonality is one of those creeping viral problems. If you introduce some new functionality and you realize you've coupled it to something unnecessarily, you might say, "These two things shouldn't really know about each other, but it's OK. It's just these two things." But the next functionality you add might also know about something it shouldn't. Soon you have four things that know about each other that shouldn't. The problem grows somewhat unexpectedly. You get a system that quickly becomes a nightmare. One way we illustrate a highly coupled system in the book is the helicopter story.

Bill Venners: I thought the helicopter story was a great illustration. Why don't you tell it?

Dave Thomas: A helicopter has four main controls: foot pedals, collective pitch lever, cyclic, and throttle. The foot pedals control the tail rotor. With the foot pedals you can counteract the torque of the main blade and, basically, point the nose where you want the helicopter to go. The collective pitch lever, which you hold in your left hand, controls the pitch on the rotor blades. This lets you control the amount of lift the blades generate. The cyclic, which you hold in your right hand, can tip one section of the blade. Move the cyclic, and the helicopter moves in the corresponding direction. The throttle sits at the end of the pitch lever.

It sounds fairly simple. You can use the pedals to point the helicopter where you want it to go. You can use the collective to move up and down. Unfortunately, though, because of the aerodynamics and gyroscopic effects of the blades, all these controls are related. So one small change, such as lowering the collective, causes the helicopter to dip and turn to one side. You have to counteract every change you make with corresponding opposing forces on the other controls. However, by doing that, you introduce more changes to the original control. So you're constantly dancing on all the controls to keep the helicopter stable.

That's kind of similar to code. We've all worked on systems where you make one small change over here, and another problem pops out over there. So you go over there and fix it, but two more problems pop out somewhere else. You constantly push them back—like that Whack-a-Mole game—and you just never finish. If the system is not orthogonal, if the pieces interact with each other more than necessary, then you'll always get that kind of distributed bug fixing.

The funny thing about the helicopter story is that I'm not a helicopter pilot. When I wrote the helicopter story, I wanted to make sure it was accurate. I knew of a USENET group on helicopters, so I posted the helicopter story saying, "This is what I'm intending to write about how helicopter controls work. Is it correct? A helicopter pilot emailed me and said, "I read what you wrote about controlling helicopters. I didn't sleep all night."

Next Week

Come back Monday, March 17 for Part III of this conversation with Pragmatic Programmers Andy Hunt and Dave Thomas. If you'd like to receive a brief weekly email announcing new articles at Artima.com, please subscribe to the Artima Newsletter.

Talk Back!

Have an opinion on orthogonality, code generators, repeating yourself, or repeating yourself? Discuss this article in the News & Ideas Forum topic, Orthogonality and the DRY Principle.

Resources

Andy Hunt and Dave Thomas are authors of The Pragmatic Programmer, which is available on Amazon.com at:
http://www.amazon.com/exec/obidos/ASIN/020161622X/

The Pragmatic Programmer's home page is here:
http://www.pragmaticprogrammer.com/

Dave Thomas was not the first person I've interviewed who mentioned the arcade game Whack-a-Mole. James Gosling also called upon the versatile Whack-a-Mole metaphor while pointing out that it is sometimes hard in engineering to know if you've solved a problem or moved it:
http://www.artima.com/intv/gosling34.html

The Agile Manifesto is here:
http://agilemanifesto.org/

Ward's Wiki, the first WikiWikiWeb, created by Ward Cunningham, is here:
http://c2.com/cgi/wiki?WelcomeVisitors

<<  Page 3 of 3

Orthogonality and the DRY Principle -- 2

Orthogonality and the DRY Principle
A Conversation with Andy Hunt and Dave Thomas, Part II
by Bill Venners
March 10, 2003

<<  Page 2 of 3  >>

Advertisement
&lt;script language="JavaScript" type="text/javascript"&gt; document.write('&lt;a href="http://clk.atdmt.com/XDA/go/rtmsfaml0040000015xda/direct/01/" target="_blank"&gt;&lt;img src="http://view.atdmt.com/XDA/view/rtmsfaml0040000015xda/direct/01/"/&gt;&lt;/a&gt;'); &lt;/script&gt;&lt;noscript&gt;&lt;a href="http://clk.atdmt.com/XDA/go/rtmsfaml0040000015xda/direct/01/" target="_blank"&gt;&lt;img border="0" src="http://view.atdmt.com/XDA/view/rtmsfaml0040000015xda/direct/01/" /&gt;&lt;/a&gt;&lt;/noscript&gt;

Building Code Generators

Bill Venners: If you build a code generator to avoid duplication, you must invest the time to build and maintain the code generator. You have to explain the code generator to other team members. Therefore, creating a code generator has costs as well as benefits. How do you decide when the return on investment is great enough to actually justify building one?

Dave Thomas: You never build a code generator just because you feel like it. You build one because you are motivated by some underlying principle, like avoiding duplication. Or, sometimes you might want to encapsulate the knowledge of an expert and make it available to other people. For example, you can tell a Microsoft IDE that you want a new MFC (Microsoft Foundation Classes) application, and it will generate 2000 lines of code for you. Most people who use it, to their shame, don't understand that code. Some expert at Microsoft said this is the way it should be, and the whole world followed suit. Don't use code generators because you fancy doing it. Use them because there's a business benefit to doing so.

That's true for all the tools we recommend using. Don't use them just because they're there. Use them because they fit into the overall philosophy of how you want to develop.

Andy Hunt: Creating a code generator is an investment. You're banking that it will be cheaper in the long run to build the code generator, because as changes come up you can simply tweak the input to the code generator and regenerate the byproducts. Without a code generator, you will have to manually make changes by hand each time to all the byproducts. If you expect a lot of volatility, a code generator can be a good investment.

Dave Thomas: In fact, I'd go further. Typically, if I build a code generator, chances are good I will generate the products manually first. And only when I come back to it will I say, "I'm now in a situation where I need to automate this." That approach has two benefits. First, I might never come back, in which case I don't have to write the code generator. If I do come back, I've already validated the code generator's output. So I don't just march off into the unknown, I actually aim at a definite target.

Bill Venners: I once had a manager who discouraged me from making a code generator tool by using the argument, "But then we'll have to maintain the tool." I later decided he was right in that case, because it was better for the company that I just write the code by hand. In a different case, though, I created a code generation tool that paid for itself. We had a database whose schema changed from release to release. My code generator read in an SQL database schema, that we had to create anyway to change the database, and generated the layer, a C module, between the database and the code. Every time we changed the database, boom, we just regenerated the layer. It saved time and bugs, because once we got the bugs out of the code generator, the C code it generated never contained any bugs.

Dave Thomas: There's also a subtle effect that comes about when you create a code generator. If you remove the friction for change, you'll find yourself making changes you need to make more often. That's a good thing.

Andy Hunt: You're not resisting the process.

Dave Thomas: Right. Maybe a schema change is not a great example, because you don't make gratuitous schema changes. But if you have a code generator that makes something painless, then you're more likely to use it. That means you're more likely to keep things tidy and clean. And you'll extend the life of your software. It's a good habit to follow.

Andy Hunt: This relates to working with metadata, an idea presented later in the book. The idea is to work closer to the level of what you want to express. In the case of schema change, you'll go into an SQL file and make a schema change. You don't have to change member variables and data fields just because the schema changed, the code generator does that for you. When you need to make a schema change, you make it and hit the button. Metadata keeps the act you must perform commensurate with the change itself. You want to avoid, at all costs, a little change that requires a bunch of other tasks. That kind of magnification kills many projects. The simple code generator or equivalent metadata technique keeps the actions commensurate.

Dave Thomas: This extends to the idea of orthogonality. If you have a truly orthogonal system, unrelated elements are expressed independently. Here you have a business-level change: one thing changes at the business level and one thing changes in the system. If the boss says, I want negative numbers red, you change one thing and suddenly all the negative numbers in the system are red.

Andy Hunt: That sounds a lot like DRY: One piece of knowledge in the domain changes, one piece of the system changes.

Dave Thomas: That almost happened to me about a month ago. I was working with a large web application that dealt with registrations in an online membership system. The numbers started out small, a couple hundred here and there. As it grew to tens of thousands, the client found the numbers difficult to read, so they requested commas in all the numbers. Luckily, I only had one change to make, and every number the system outputted then had commas in it. That's an important thing to think about. Code generators let you do that, because they let you have one expression of something.

<<  Page 2 of 3  >>

Orthogonality and the DRY Principle -- 1

Orthogonality and the DRY Principle
A Conversation with Andy Hunt and Dave Thomas, Part II
by Bill Venners
March 10, 2003

Page 1 of 3  >>

Advertisement

Summary
Pragmatic Programmers Andy Hunt and Dave Thomas talk with Bill Venners about maintenance programming, the DRY principle, code generators and orthogonal systems, and a story about one highly coupled control system: the helicopter.

Andy Hunt and Dave Thomas are the Pragmatic Programmers, recognized internationally as experts in the development of high-quality software. Their best-selling book of software best practices, The Pragmatic Programmer: From Journeyman to Master (Addison-Wesley, 1999), is filled with practical advice on a wide range of software development issues. They also authored Programming Ruby: A Pragmatic Programmer's Guide (Addison-Wesley, 2000), and helped to write the now famous Agile Manifesto.

In this interview, which is being published in ten weekly installments, Andy Hunt and Dave Thomas discuss many aspects of software development:

  • In Part I. Don't Live with Broken Windows, they discuss the importance of software craftsmanship and the importance of staying on top of the small problems in your projects.
  • In this installment, they discuss the importance of keeping your system orthogonal, and the real meaning the DRY, or Don't Repeat Yourself, principle.

All Programming is Maintenance Programming

Bill Venners: You say in your book, The Pragmatic Programmer (Addison-Wesley, 1999), that "programmers are constantly in maintenance mode." Why?

Dave Thomas: All programming is maintenance programming, because you are rarely writing original code. If you look at the actual time you spend programming, you write a bit here and then you go back and make a change. Or you go back and fix a bug. Or you rip it out altogether and replace it with something else. But you are very quickly maintaining code even if it's a brand new project with a fresh source file. You spend most of your time in maintenance mode. So you may as well just bite the bullet and say, "I'm maintaining from day one." The disciplines that apply to maintenance should apply globally.

Andy Hunt: It's only the first 10 minutes that the code's original, when you type it in the first time. That's it.

The DRY Principle

Bill Venners: What's the DRY principle?

Dave Thomas: Don't Repeat Yourself (or DRY) is probably one of the most misunderstood parts of the book.

Bill Venners: How is DRY misunderstood and what is the correct way to understand it?

Dave Thomas: Most people take DRY to mean you shouldn't duplicate code. That's not its intention. The idea behind DRY is far grander than that.

DRY says that every piece of system knowledge should have one authoritative, unambiguous representation. Every piece of knowledge in the development of something should have a single representation. A system's knowledge is far broader than just its code. It refers to database schemas, test plans, the build system, even documentation.

Given all this knowledge, why should you find one way to represent each feature? The obvious answer is, if you have more than one way to express the same thing, at some point the two or three different representations will most likely fall out of step with each other. Even if they don't, you're guaranteeing yourself the headache of maintaining them in parallel whenever a change occurs. And change will occur. DRY is important if you want flexible and maintainable software.

The problem is: how do you represent all these different pieces of knowledge only once? If it's just code, then you can obviously organize your code so you don't repeat things, with the help of methods and subroutines. But how do you handle things like database schemas? This is where you get into other techniques in the book, like using code generation tools, automatic build systems, and scripting languages. These let you have single, authoritative representations that then generate non-authoritative work products, like code or DDLs (data description languages).

Page 1 of 3  >>

Anders Hejlsberg

Anders Hejlsberg

Anders Hejlsberg (born c. 1961[1]) is an influential Danish software engineer who co-designed several popular and commercially successful programming languages and development tools. He currently works for Microsoft, where he is the lead architect of the C# programming language.

Early life

Hejlsberg was born in Copenhagen, Denmark, and studied engineering at the Technical University of Denmark. Whilst at university in 1980 he began writing programs for the Nascom microcomputer, including a Pascal compiler which was initially marketed as the Blue Label Pascal compiler for the Nascom-2. However, he soon rewrote it for CP/M and MS-DOS, marketing it first as Compas Pascal and later as PolyPascal. After the product was sold to Borland, it was marketed as the Turbo Pascal compiler.

At Borland

After Borland's takeover, Turbo Pascal became the most commercially successful Pascal compiler ever. As part of the deal that saw Borland take control of Turbo Pascal, Hejlsberg became Chief Engineer at Borland, where he remained until 1996. During this time he developed Turbo Pascal further, and eventually he became the chief architect for the team which produced the replacement for Turbo Pascal, Delphi.

At Microsoft

In 1996, Hejlsberg left Borland and joined Microsoft. One of his first achievements was the J++ programming language and the Windows Foundation Classes; he also became a Microsoft Distinguished Engineer and Technical Fellow. Since 2000, he has been the lead architect of the team developing the C# programming language.

Awards

He received the 2001 Dr. Dobb's Excellence in Programming Award for his work on Turbo Pascal, Delphi, C# and the Microsoft .NET Framework.

Notes

  1. ^ Hejlsberg states in a video at the Microsoft Museum that his birthdate is 1960, but most other sources say 1961.

External links

Interviews

Videos

This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)

8月2日

定义

  • AOR(Address-of-Record):SIP or SIPS URI,是用户的公共地址(该地址包含一domain)。
  • B2BUA(Back-to-Back User Agent):既是UACuser agent client)又是UASuser agent server,维护对话状态,必须参与会后过程中所有的requests
  • Call Stateful:描述Proxy,若proxy call stateful,那么proxy将保留对话从INVITE BYE的状态,若proxyCall Stateful那么也可以认为该proxy transaction stateful.
  • Client:UACproxies都是Client,发送请求并接收响应。
  • Core:指proxy, a user agent or registrar,除了stateless proxy,其余的都是transaction user
  • Dialog:两个UA间,点对点通信。
  • Downstream:request的方向,指requestUACUAS
  • Final Response: A response that terminates a SIP transaction, as opposed to a provisional response that does not.  All 2xx, 3xx,4xx, 5xx and 6xx responses are final.
  • Home Domain:为SIP用户提供服务(定位服务,把URI映射到另一个可用的URI)。通常指AOR中注册的domain
  • Initiator, Calling Party, Caller:会话发起者,即发送INVITE建立会话的一方。
  • Invitation: An INVITE request.
  • Invitee, Invited User, Called Party, Callee:接收到INVITE的一方。
  • Location Service:由SIP redirect or proxy server使用,该服务能够获取callee可能所在的位置。该服务包含一AOR绑定列表,这个列表可以通过REGISTER方法来更新。
  • Loop:指消息回环,消息回环是一个错误。
  • Loose Routing:把目标从路由上的proxies分离的proxy,为Loose Routing proxy
  • Method:包含在request消息内的,需要在server执行的原子操作。比如INVITEBYE
  • Outbound Proxy:UA的代理,通常通过手工或自动配置协议获取,该proxyUA发送requet到达的第一个server(即使该sever并非URI中指定的目标主机)。
  • Parallel Search:同时发送多条请求到可能的用户location
  • Provisional Response:与Final Response相对,并不中断SIP transaction,所有的1xx都是临时Response.
  • Proxy, Proxy Server:扮演server and client 的角色,代表了两方clientproxy server 主要route messageproxy主要enforcing policy (for example, making sure a user is allowed to make a call)
  • Recursion: A client recurses on a 3xx response when it generates a new request to one or more of the URIs in the Contact header field in the response.
  • Redirect Server:为user agent server,回应3xx请求,指导用户访问一些中间的URI
  • Registrar:接收REGISTER请求并把消息交给location service
  • Regular Transaction: 非INVITE, ACK, or CANCEL的事务。
  • Route Set: 一组排序好的SIP or SIPS URI(即proxy),request必须经过这些proxiesRoute set可以learn from 头信息(比如Record-Route)或配置
  • Sequential Search:必须在前一个请求得到响应后才能发起下一个请求,2xx or 6xx能终止sequential search.
  • Spiral:request又回到先前的proxy,但和Loop不同,其URI改变了。Spiral不属于错误,是允许的。
  • Transaction User (TU):Transaction users include the UAC core, UAS core, and proxy core.
  • Upstream:直接从UASUAC的消息。
  • User Agent Client (UAC): 是一个逻辑实体,发起请求时,在这个事务中属于UAC,当其回应请求时,在这个事务中属于UAS
  • UAC Core:位于事务层和传输层之上,为UAC提供服务。
  • User Agent Server (UAS):逻辑实体,当响应请求时的处理过程,实体为UAS;当发起请求时又转换为UAC
  • UAS Core:位于事务层和传输层之上,为UAS提供服务。
  • User Agent (UA): 逻辑实体, 既是UAC又是UAS