子瞻的技术空间

收雨集露,厚积薄发
 
 

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔档案

  • 2012年3月 (1)
  • 2010年7月 (1)
  • 2010年1月 (1)
  • 2009年12月 (2)
  • 2009年10月 (1)

文章档案

  • 2012年3月 (1)
  • 2011年8月 (1)
  • 2010年7月 (1)
  • 2010年2月 (1)

搜索

  •  

最新评论

  • 1. re: JAVA 连接 Https Server, 用户认证后获取网页内容
  • 评论内容较长,点击标题查看
  • --clausewitzer
  • 2. re: ABC of Extensibility && Scalability
  • 对哦,不但可以成比例扩展,还可以成比例缩小,谢谢~@honeyjava
  • --柴子瞻
  • 3. re: ABC of Extensibility && Scalability
  • 后者叫可伸缩性
  • --honeyjava

阅读排行榜

  • 1. 解决MYSQL出现Can't create/write to file 'C:\WINDOWS\TEMP\#*.MYD' (Errcode: 17)一类问题(3056)
  • 2. ZZ java获得CPU使用率,系统内存,虚拟机内存等情况(不用JNI or Sigar)(1839)
  • 3. 弄清楚脏读、不可重复的读和虚读(942)
  • 4. ABC of Extensibility && Scalability(739)
  • 5. Static Import since 1.5(289)

评论排行榜

  • 1. ABC of Extensibility && Scalability(2)
  • 2. 弄清楚脏读、不可重复的读和虚读(0)
  • 3. ZZ java获得CPU使用率,系统内存,虚拟机内存等情况(不用JNI or Sigar)(0)
  • 4. 解决MYSQL出现Can't create/write to file 'C:\WINDOWS\TEMP\#*.MYD' (Errcode: 17)一类问题(0)
  • 5. Dump抓取(0)

Powered by: 博客园
模板提供:沪江博客
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

2010年1月13日

Dump抓取
windbg目录,采用工具cdb生成dump文件:cdb -pv -pn 进程名 -c ".dump /m c:/文件名.dmp;q"。
例如:
cdb -pv -pn explorer.exe -c ".dump /m c:/explorer.dmp;q"
posted @ 2012-03-28 14:24 柴子瞻 阅读(218) | 评论 (0) | 编辑 收藏
 
Static Import since 1.5
In order to access static members, it is necessary to qualify references with the class they came from. For example, one must say:
double r = Math.cos(Math.PI * theta);
In order to get around this, people sometimes put static members into an interface and inherit from that interface. This is a bad idea. In fact, it's such a bad idea that there's a name for it: the Constant Interface Antipattern (see Effective Java Item 17). The problem is that a class's use of the static members of another class is a mere implementation detail. When a class implements an interface, it becomes part of the class's public API. Implementation details should not leak into public APIs.

The static import construct allows unqualified access to static members without inheriting from the type containing the static members. Instead, the program imports the members, either individually:

import static java.lang.Math.PI;
or en masse:
import static java.lang.Math.*;

Once the static members have been imported, they may be used without qualification:
double r = cos(PI * theta);
The static import declaration is analogous to the normal import declaration. Where the normal import declaration imports classes from packages, allowing them to be used without package qualification, the static import declaration imports static members from classes, allowing them to be used without class qualification.

So when should you use static import? Very sparingly! Only use it when you'd otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). In other words, use it when you require frequent access to static members from one or two classes. If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from. Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually. Used appropriately, static import can make your program more readable, by removing the boilerplate of repetition of class names.

posted @ 2010-07-03 21:12 柴子瞻 阅读(289) | 评论 (0) | 编辑 收藏
 
ABC of Extensibility && Scalability

 

我想计算机专业的兄弟们对标题的这两个词恐怕都不陌生吧!我们会在很多文档中找出这两个词,一般是形容某某系统的优点,或者是形容某某架构的优势等等。甚至有的时候我们自己会说我们做的项目有很好的“Extensibility”和“Scalability”。

更有趣的是,这两个词经常会出现在描述同一事物上,而且单词会紧挨着。我估计以英语为母语的人会明白这二者到底指的是什么意思,但是咱们中国的IT人士是否能明白二者到底是什么意思呢?

乍一翻译过来,Extensibility是“可扩展性”,而Scalability也可以翻译成“可扩展性”或者“规模可扩展性”。反正我是这么翻译的。这么一看,这二者不意思差不多嘛!那干嘛还用两个词阿?写一个算了。

而实际并非如此,虽然Extensibility和Scalability翻译成中文很相近,但是二者却有着截然不同的内涵。

Extensibility, 表明系统设计的原则,考虑到了将来对系统实现的更改和增强。如果一个系统有很好的Extensibility,那么当对该系统某部分进行功能的添加或修改时,几乎不会影响到系统现有的其他部分。

Scalability, 表示的是当对一个系统的任务量或工作量增加时,该系统能够用一个优雅的方式来应对,而且达到了很好的效果。比如,当一个系统在增加了硬件资源之后,它的性能随之也能够成比例的提升,这就表明这个系统有很好的Scalability。

通过上面的解释,我想你差不多能明白二者到底表明什么意思了吧!虽然都有“扩展性”的意思,但是表现的方面可是不相同的。

posted @ 2010-01-13 23:19 柴子瞻 阅读(739) | 评论 (2) | 编辑 收藏