Đang chuẩn bị liên kết để tải về tài liệu:
Lập trình Wrox Professional Xcode 3 cho Mac OS part 26
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Nếu bạn đang như tôi, bạn ghét bỏ mã. Hầu hết các mã, đặc biệt là những thứ mà các công trình, là một mặt hàng khó giành được đại diện cho thời gian, nỗ lực, chuyên môn, và sáng tạo. Cách tốt nhất để cải thiện mã của bạn, tuy nhiên, là để thử nghiệm các cách tiếp cận mới - mà thường có nghĩa là từ bỏ hoặc loại bỏ các mã bạn đã viết. | 11 Snapshots WHAT S IN THIS CHAPTER Taking snapshots of your entire project Reviewing snapshots and comparing them with your working files Managing and restoring snapshots If you re like me you hate to throw away code. Most code especially the stuff that works is a hard-won commodity that represents time effort expertise and creativity. The best way to improve your code however is to experiment with new approaches which often means abandoning or discarding the code you ve already written. Making copies of your source files or saving snippets of old code as comments is both awkward and time consuming. Enter snapshots. Snapshots let you have it both ways you can keep your existing code while simultaneously replacing it with new experimental code. In simple terms a snapshot is an archived copy of the source files in your project. It quickly preserves their current state so you are free to make changes to your project even radical ones secure in the knowledge that you can always revert back to the saved version at any time. You can make as many snapshots as you like. You can easily see what changes you ve made as shown in Figure 11-1 by comparing your working project files to those in a snapshot. You can revert your changes to any previous snapshot on a change-by-change basis by file or perform a wholesale restore of the entire project. Download at getcoolebook.com 202 CHAPTER 11 SNAPSHOTS FIGURE 11-1 Snapshots encourage experimentation by making it easy to save and contrast existing code with new code. There s very little risk in rewriting a collection loop to improve performance when Xcode will preserve the previous implementation. Take a snapshot rewrite the loop and test its performance. Is it an improvement Keep the new code. Not an improvement Restore the saved snapshot and move on or try a different approach. It s that simple. Snapshots resemble a source control system but shouldn t be treated as one. Each snapshot is conceptually a complete and independent copy