Tekkaman

导航

 

Cocoa设计之TwoStage Creation

  TwoStage Creation有三个好处:

  1、Enable the use of initializers regardless of the way memory is allocated 

  2、Avoid the need to implement too many initializers when subclassing

  3、Simplify the creation and use of temporary instances 

  

  个人认为最主要的还是通过拆分分配与初始化,避免了初始化方法的几何增长爆炸。参考《Cocoa设计模式》。

posted on 2013-02-04 16:25  Tekkaman  阅读(213)  评论(0编辑  收藏  举报