2009年8月17日

英文里动词是一个句子中不可缺少的部分。
1.完全及物动词
动词加了宾语后意思很完全。
形态:
主语+完全及物动语+宾语
I love her.
Don't hit me.
主语+be动词+现在分语+宾语
I am pulishing him.
主语+be动语+过去分语
He was hit.
2.完全不及物动词
形态:
主语+完全不及物动词
He ran.
主动+be动词+现在分词
He was running.
3.不完全不及物动词 例如:be动语
主语+不完全不及物动语+补语
He becomes handsome.
He got mad/angry/hungry
He got hurted/killed.
He face turned pale.
The leaves are turning yellow.
4.不完全及物动词
I make him wash the car. make/have sb do sth(动词原型)
get sb to do sth
let sb do sth
I let him sing a song.
let up雨停了
I have a house to let.我有房子要出租

I will force him to do it.
That story cause me to cry.

5.受予动词
I gave him a car.
give后跟的是双宾语,第一个间接宾语(通常是人或对象),第二个直接宾语(通常是事或物)
tell,lend
I gave a book to him.
I teach english to him.
I bought a book for him.
I made a chair fom him.

posted @ 2009-08-30 21:35 在从未放弃的路上 阅读(169) | 评论 (0)编辑 收藏

在英文里,动语不能直接做主语,要变为动名词或者不定式短语。
例如:
Working with him is interesting.
To learn engish with peter is fan.
动名词用于做有经验的事情。
不定式用于没有实现的事情,例如计划,设想等。

如果不定式短语做为主语过长,可以虚的主语,it来代替,不定式短语放在句尾。
例如:
It it my plan to study aboard with very good friend of mine whose call jone.

中文里可以用句子做主语,而英文里不可以,要将句子变为名词从句。
句子前面加一个连词that,构成名词从句。
例如:
That she loves me is ture.
That he doesn't agree with me makes me angry.
It makes me angry that he doesn't agree with me.

posted @ 2009-08-29 20:37 在从未放弃的路上 阅读(2853) | 评论 (0)编辑 收藏

1.Self Encapsulate Field

为这个field建立getting/setting method,并且只通过这些函数来访问field.
例:
privte int low,high;
boolean includes(int arg){
    return arg>=low&&arg<=high;
}
重构为:
private int low,high;
boolean includes(int arg){
    return arg>=getLow()&&arg<=getHigh();
}
int getLow(){return low;}
int getHigh(){return high;}

2.Replace Data Value with Object
将一个数据项变成一个对象。
3.Change Value to Reference
将这个实值对象变成一个引用对象。
4.Change Reference to Value
将一个引用对象变成实值对象。
例:
Class Currency{
private String code;
public String getCode()}
    return code;
}
private Currency(String code){
    this.code=code;
}
}
5.Replace Array with Object
以对象替换数组,对于数组中的每个元素,以一个值域表示之。
例:
String[] row=new String[3];
row[0]="Liverpool";
row[1]="15";
重构为:
Performance row=new Performance();
row.setName("Liverpool");
row.setWins("15");
6.Duplicate Observed Data
7.Change Unidirectional Association to Bidirectional
8.Change Bidirectional Association to Unidirectional

posted @ 2009-08-18 21:02 在从未放弃的路上 阅读(217) | 评论 (0)编辑 收藏

Abstract Factory
通过工厂类创建某一对象,而不是直接使用new关键字。
public class Computer(){
}
public class NoteBookComputer extends Computer(){
}
public abstract class ComputerFactory(){
    public abstract Computer createComputer();
}
public class NoteBookComputerFactory extends ComputerFactory{
     public Computer createComputer() {
         return new NoteBookComputer();
    }
}
client code:
ComputerFactory factory=new NoteBookComputerFactory();
Computer noteBook=factory.createComputer();

posted @ 2009-08-18 21:01 在从未放弃的路上 阅读(167) | 评论 (0)编辑 收藏

1.Singleton(单例模式)
一个类在系统中只存在一个实例,并提供该实例的全局访问点。
样例代码,lazy-load:
public class Singleton {
 private static Singleton instance;
 private Singleton(){
  
 }
 public static synchronized Singleton getInstance(){
  if(instance==null)
   instance=new Singleton();
  return instance;
 }
}
or
public class Singleton(){
    public static final Singleton instance=new Singleton();
    private Singleton(){
    }
}

 

posted @ 2009-08-17 22:32 在从未放弃的路上 阅读(161) | 评论 (0)编辑 收藏


posts - 9, comments - 0, trackbacks - 0, articles - 3

Copyright © 在从未放弃的路上