错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Creating Quality Methods

  • Carleton DiLeo

摘要

Methods are the smallest block of code in our application. They encapsulate logic for reuse which helps prevent duplication and speeds up refactoring. The process of creating methods is more than copying a chunk of code and wrapping it in a method definition. Quality methods take careful planning and consideration, much like variables. More often than not, it requires multiple passes to craft it into something that we can be proud of, each time refining the logic and removing the cruft.