Đ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 38
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Để có một đối tượng định hướng lập trình hiệu quả, bạn phải có một hình ảnh rõ ràng tinh thần của các tầng lớp trong ứng dụng của bạn và các mối quan hệ của họ. Đôi khi điều này "hình ảnh" khó mà hình thức, bởi vì mối quan hệ có thể được cả lớp phức tạp và trừu tượng. | 14 Class Modeling WHAT S IN THIS CHAPTER Graphically modeling classes Learning the basics of the Xcode modeling tools Customizing diagrams and filtering out extraneous detail To be an effective object-oriented programmer you must have a clear mental picture of the classes in your application and their relationships. Sometimes this picture is hard to form because class relationships can be both complex and abstract. The class browser discussed in Chapter 9 uses the project s index to list your project s classes. Although this helps it still doesn t present a bird s-eye view of your application s structure. Enter class modeling. Class modeling performs the same function as the class browser but in a much more visual and customizable way. You model classes by creating a class model document. The document can include any set of classes this could be your entire application or just a set of functionally related classes. Xcode then graphs those classes as shown in Figure 14-1. The class model tracks and instantly reflects any changes made to your source files. Unlike data modeling discussed in the next chapter the class modeler is not an editor. You cannot design or alter the declarations in a class model and then transform that model into code. In other words the class modeler is not a UML design tool. Download at getcoolebook.com 286 CHAPTER 14 CLASS MODELING Class models are really useful when You want to maintain a clear picture of a complex set of classes. You re considering refactoring a group of classes. You re trying to assimilate a set of classes written by another developer or team. You want to clearly document a set of classes for other developers. If you re not in any of those circumstances don t skip to the next chapter just yet. There s one more reason why you should learn to use the class modeler The class modeling tools use nearly the same interface as the data modeling tools. Download at getcoolebook.com Creating a Class Model 287 The data modeling tools