Organization of This Document
See Also
As programmers develop and maintain a software product, despite their best efforts, the changes they make may degrade the quality of the product’s source code. Good-quality source code is easy to understand and allows programmers to get up to date on a project in a short time. In such a project, for example, classes have well-defined responsibilities; they do few things and do them well, Bad-quality source code is hard to understand. The classes in such a project may have several areas of responsibility, making it hard to decide where to add code to implement a new feature.
Projects with good-quality source code tend to lose their quality as they are changed. For example, fixing a set of problems in a product in time to meet a deadline may require making hastily conceived changes that may make the product’s source code harder to understand for people not familiar with the product. New team members, and even the developers who made changes to the source code in the past, may have trouble understanding that same source code as a whole or its individual components at a later date because the purpose of classes and methods is not obvious or clear.
To address this problem, developers use a quality-improvement process called “refactoring.” In short, refactoring makes code easier to understand and maintain without changing the behavior of the product.
This document shows how to perform refactoring operations using Xcode. It does not teach you refactoring.
This document contains the following chapters:
“Refactoring Overview.” Provides a brief introduction to source code refactoring.
“Refactoring Workflow.” Shows the workflow used to perform refactoring operations in Xcode.
“Refactoring Transformations.” Describes the refactoring operations (transformations) in Xcode.
To learn about refactoring, you should consult the books that cover this topic in depth. One such book is Refactoring: Improving the Design of Existing Code, by Martin Fowler. This book provides in-depth discussions about the refactoring process and describes refactorings that solve common problems in source code that make it hard to understand
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)