代碼設計中常見的pitfall-----翻譯《An Introduction to Design Patterns in C++ with Qt4 》

 文章提到 anti-patterns 主要是代碼設計中常見的問題編程

  • Copy and paste programming:Copying and modifying existing code without creating more generic solutions. 複製粘貼式編程,僅僅使用現有的代碼,而不去設計一種通用的解決方案。app

  • Hard coding:Embedding assumptions about the environment (such as constant numbers) in multiple parts of the software. 硬編碼ide

     

  • Interface bloat:Having too many methods, or too many arguments in functions; in general, refers to a complicated interface that is hard to reuse or implement. 接口膨脹:方法太多/參數太多,難以重用和實現。編碼

     

  • Reinventing the (square) wheel:Implementing some code when something (better) already exists in the available APIs. 重造輪子(這裏指的是現成的更好的解決方案,須要與複製粘貼式編程區分開)spa

     

  • God Object:An object that has too much information or too much responsibility. This can be the result of having too many functions in a single class. It can arise from many situations, but often happens when code for a model and view are combined in the same class. 超級類:一個類的職責太多和信息量太大設計

相關文章
相關標籤/搜索