2005年4月3日

First, read this doc carefullly on  objectlearn.com

Tips 1:EMF MUST BE INSTALLED PRIOR TO USING LOMBOZ.
Using google, you'll find many article about the Installation of Lomboz. But many of them didn't talk about the EMF. I haven't used Lomboz 2.X on eclipse 2.X, perhaps that old version didn't need EMF. Now, Lomboz v3.x uses models based on EMF. So EMF must be installed with Lomboz.

Tips 2: IT IS VERY IMPORTANT THAT YOU CLICK APPLY 
Your change will be taken into account only after this. It's very strange -_-b

BTW, the speed for exploring websites abroad is very very slow these days. For example , eclipse.org, sourceforge.net and so on.  My ISP is Shanghai's Oriental Cable Network.

posted @ 2005-04-03 09:52 Blue Kong 阅读(501) | 评论 (0)编辑 收藏

2005年3月11日

Good, I prefer it to blojsom, for it's running well on my server now but blojsom can't.

let's try it

posted @ 2005-03-11 16:11 Blue Kong 阅读(357) | 评论 (1)编辑 收藏

最近刚开始使用firefox,虽然还有很多网站的代码不能符合mozilla的标准。但是,因为一些细节,我还是喜欢上了firefox。

举两个例子:
你是否有时候被一些网站匪夷所思的小字体所困扰?IE提供的查看--〉字体大小在绝大多数场合下都是无用的 :(  firefox里,你只需要轻松的ctrl + +/- ,哈哈,再也不会有什么小字体看不清楚地恼人事情了。

原本blogjava.net使用的post edit的代码嵌入使用DIV,在处理 /* */ 注释时,缩放的按钮在IE下不能正常工作。现在在firefox里可以了。


当然,由于兼容问题,如果只使用firefox,在访问相当一部分网站时还是会发生问题的。所以,双开啊。


BTW,顺便问一下,有人知道什么用java写的优秀blog程序么? 如现在这样使用.text总觉得有些奇怪,呵呵。尝试过 blojsom ,不知道为什么,我始终无法成功的让其使用mysql作为数据库。 而且,在建立catalog时,也总是发生奇怪的结果。例如,同名catalog,post无法归入某个catalog

posted @ 2005-03-11 11:11 Blue Kong 阅读(590) | 评论 (0)编辑 收藏

2005年3月5日

找到两个简单的guide,记下来备用:

http://fedoranews.org/contributors/stanton_finley/fc3_note/



http://www.mjmwired.net/resources.php?PHPSESSID=e63a1fe2caddc29e491f26c285189cdf

posted @ 2005-03-05 20:21 Blue Kong 阅读(279) | 评论 (0)编辑 收藏

2005年1月27日

//从老家搬篇过来,看看排版与显示效果如何。

 

6. Reusing Classes

Java编译器并不会给任何reference产生缺省对象,这样就避免了大多数情况下的不必要的负担。初始化需要的对象可以在以下地点:

1,对象定义处。由于类初始化顺序的规则,这样做可以保证以此方法初始化的对象将会在构造函数被调用前完成初始化。
2,构造函数内部。
3,当需要使用该对象时,这种方式被称为(缓式初始化)lazy initialization。如果一个对象并非总是必须,那么这种方式可以减少额外负担。

关于清理动作,要注意的是顺序:首先执行当前类的所有清理动作(其中次序和生成次序相反),而后再调用base class的清理函数。外带一句,除了内存,最好永远不要相信垃圾回收机制。

Final data

Bruce在这部分说:Java中final修饰对于基本类型和对象引用(object reference)而言,意义是不同的。用于基本类型时,final让value(数值)保持不变。用于object reference时,final让reference保持不变,但对象本身的内容却是可以更动的恶。Java并未提供让任何对象保持不变的机制,虽然可以自己编写具有保持不变效果的class。特别提醒,array也是对象。

我要说的是,我没发现final在基本类型与对象引用的意义有何不同。final都是让两者的value保持不变,基本类型的value就是对应的数值或者bool值。而对象引用的value在理解上可以解释为指向object的地址。当然,这里似乎对于Java的底层实现做了假设而我确实也没细究过Java如何实现object reference的。但是,就Java语法及我个人的体会而言,我觉得这是很好的一种理解方式。

Blank finals

Java允许把数据成员声明为final却不赋予初始值。当然,final修饰的数据成员必须在其被使用前完成初始化,这一点由编译器保证。这个特性让我们可以把某个数据成员声明为final具有不变的特性,却在每个对象中为不同的值。

Final arguments

Java中还可以把method的arguments声明为final,意义不变,只是不变特性的范围仅仅在此method内。对于对象引用,即是在此method内拥有此对象的一个不可变更的引用,而不影响此对象存在其他非final的引用。

Final method

有两个原因把一个method修饰成final。第一,对于类A中的某个method,你希望在类A所有子类中此方法的表现不变,即此方法不可被覆写(overriding)。第二,处于效率考虑,因为编译器会尝试把不太长的final method改为inner method。而Bruce Eckel建议我们不要相信编译器的智商,只在确实处于设计的考虑需要时,才把method修饰为final。

final & private

private的method对于子类是不可见的,自然也无法覆写(overriding)。似乎,private隐含了final?如果一个函数已经是private,似乎final修饰与否都无关紧要? 
首先,这两个假设,前者错误,后者正确。因为private的method对于子类是不可见的, 所以对于子类而言如此的函数就如同是父类中的一段普通代码。如果此时在子类中声明一个与父类中的private method同名的函数,编译器是允许的。然而,注意,此时只是在这个继承体系中加入了一个新函数而已,并非是一个覆写。因为覆写(overriding)的前提是,被覆写的函数是可见,是父类的对外的界面。至于对private函数再加final修饰,编译器是允许的。但毫无意义,因为private的函数对于子类不可见,所以也就无需声明是否允许覆写(overriding)。

下面还是贴段代码来解释:

/*
 * Created on 2004-11-30
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 
*/

package com.smilereader.test;

/**
 * @author Sinbadblue Kong
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 
*/

class Treasure {
    
    
private final void f(){
        System.
out.println("Treasure.f()");
    }

    
    
private void g(){
        System.
out.println("Treasure.g()");        
    }

    
    final 
void e(){
        System.
out.println("Treasure.e()");
    }

    
}


/*
 * Created on 2004-12-5
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 
*/

package com.smilereader.test;

/**
 * @author Sinbadblue Kong
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 
*/

class Gemstone extends Treasure {
    
    
//    add a new method Gemstone.f(), it isn't an overriding
    public final void f(){
        System.
out.println("Gemstone.f()");
        
    }

    
    
//  add a new method Gemstone.g(), it isn't an overriding
    public void g(){
        System.
out.println("Gemstone.g()");
    }

 
    
//can't overriding Treasure.e()
//    public void e(){
//        System.out.println("Gemstone.e()");
//    }

}


我觉得Java的编译器在此处的处理不太合适,容易导致混淆。如果对于private 与 final修饰做互斥处理,我个人觉得会是比较合适的又容易理解的方式。

posted @ 2005-01-27 08:58 Blue Kong 阅读(553) | 评论 (0)编辑 收藏

2005年1月25日

去年用英文写BLOG时的帖子,自己转自己,叫自转 :P

The Open Closed Principle (OCP) states that we should be able to add new features to our system without having to modify our set of preexisting classes. The following Class Diagram shows that how to design the relationship between the classes so as to adhere the OCP under certain circumstance:

The User class has a relationship to the UserType abstract class. The simple sample design shows that it adheres one of the tenets of OCP:“to reduce the coupling between classes to the abstract level. Instead of creating relationships between two concrete classes, we create relationships between a concrete and an abstract class ,or in Java, between a concrete class and an interface.

Principles should be reminded again and again. ^_^

posted @ 2005-01-25 23:25 Blue Kong 阅读(510) | 评论 (0)编辑 收藏

"Everything is under testing" by Blue Kong

posted @ 2005-01-25 16:20 Blue Kong 阅读(434) | 评论 (4)编辑 收藏

仅列出标题