posts - 84, comments - 54, trackbacks - 0, articles - 0
             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          日歷

          <2007年4月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          相冊(cè)

          搜索

          •  

          最新評(píng)論

          Some good programming styles

          Posted on 2007-04-25 10:57 馬達(dá)+斯加 閱讀(215) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): My life recorder
          From <A Programming Style for Java> by Paul Haahr.
           

          Choose a good name: The reason that you can't pick a good name is that you don't understand enough what you are trying to say, or what you are going to do.

          Be consistent: Of course, which variations are purposeless and which consistencies are foolish is a subjective matter.

          Comment appropriately: If no question would be asked by the reader, there is no purpose in answer it. A comment which doesn't answer any questions is probably superfluous.

          Be a chameleon: When you are dropped into a piece of existing code, don't rewrite it all in your own style.

          Use consistent naming conventions.

          User names you can pronounce.

          Don't use abbreviations: unless everyone knows that, e.g. URL, EJB

          Don't subclass concrete classes.

          Keep classes, fields, and methods private until they are needed elsewhere.

          Use final for fields which shouldn't change.

          Make all non-final fields private: Use setter and getter to control the fields.

          Each method should do one thing.

          Smaller methods are easier to understand.

          Create new variables rather than reassigning old ones.

          Don't modify parameter variables.

          Don't use exceptions for normal control flow.
          主站蜘蛛池模板: 吉安县| 邛崃市| 鹤壁市| 昌图县| 潼关县| 东城区| 阳东县| 米泉市| 虎林市| 大埔县| 门源| 磐安县| 会东县| 阿拉尔市| 湖州市| 光泽县| 江西省| 双鸭山市| 锡林郭勒盟| 遂川县| 宜丰县| 广平县| 杭锦后旗| 乐安县| 朝阳县| 北碚区| 郸城县| 方正县| 谢通门县| 乐安县| 金堂县| 洪湖市| 霍城县| 沈丘县| 岗巴县| 江源县| 武汉市| 永川市| 华宁县| 兰坪| 吕梁市|