Java Capriccio: Scenario_1 (Java随想,第一部分)

Followings are my personal thought bubbles on java programming

[b]1. Just don't put any instance variables into your Runnable[/b]
[b]2. Be carefull when you're using 'valotile'[/b]
[b]3. Use annotation as far as possible[/b]
[b]4. If possible,anyway,use annotation to substitude of configuration file[/b]
[b]5. Would Some cohesive functions within your domain scope should be coded in your domain object[/b] [For migration || Reuse]

--------- period

[b]6. Try your best to cache your object with the modifier
'private static'[/b]
[b]7. Make the utmost use of 'Component'[/b]
[For Reuse || migration ]
Such as 'Judge Component'. 'Code Logical Component'
[b]8. Some big or long-standing object should use
the Keyword 'SoftReference'[/b]
[b]9. One class should provide simplified task[/b],
so that you can avoid of high-co-relation [避免耦合]
[b]10.Use proxy/adapter/decorator/template/command/ DPs [/b]
as far as possible

--------- period

[b]11.Avoid of Hard-Code in your code:[/b]
[list]
[*]Use interface [such as GlobalConstants]
[*]Use file [such as properties and xml files]
[/list]
[b]12.There should be serialization and De-serialization method
within any of Exception class[/b]
[b]13.Your code should be robust:[/b]
[list]
[*]catch every exception [in order to do some special process
according to the detail Exception]
[*]you must take runtime Exception into account:
such as MathException [ => multiplying two big int]
[/list]
[b]14.closure of object:[/b]
[list]
[*]if an object will never be used = > obj = null; then return;
[*]close connection
[*]close file
[/list]
[b]15.Every method should check-up the parameters , when check-up failed
the method should throw some particular Exception[/b]
[list]
[*]the parameter should be final as far as possible
[*]consider the class casting
[/list]

--------- period: 09/02,2010 11:30 am
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值