Java Capriccio: Scenario_2 (Java随想,第二部分)
1.Create & Destroy an objecta.public static Type valueOf(String name);
b.factory method: Type createByName(String name);
These methods can return subclass type
[可返回子类型,而 Constructor 则不行]
Do never use 'new' to create object
2.Avoid of re-create object
3.Eliminate of outdated references
if(size==0) this.array==null
4.Carefully use exceptions
Exceptions will effect performances of your application
5.Do never re-initialize variable
-------- period 09/02,2010 1:30 pm
6.Make the modifier of class 'final' as far as possible
So does the method!
7.Make full use of local variables {which stored stack}
页:
[1]