Xcode 2.0 is the fastest and easiest way for developers to create applications for Mac OS X Tiger. It's also the best way to take advantage of all of the new developer technologies that Apple has put into Tiger. Xcode brings together the power of UNIX, a mix of high-performance development technologies, and the ease of use of Mac OS X. Whether you're writing your application in C, C++, Objective-C, or Java, scripting in AppleScript, or looking to migrate code from another legacy tool, you'll find that Xcode is the perfect tool. Xcode 2.0 builds on the foundation previously set by Xcode 1.0 and 1.5, including such technologies as Fix and Continue, Zero Link, predictive compilation, remote debugging, distributed builds, smart groups, and code completion. On top of this foundation, Xcode 2.0 introduces a set of powerful new visualization tools, introduces new workspace layouts, comes with a new version of GCC, and software development kits for every major new technology on the system. This article shows you these new features in Xcode 2.0.
Visualize Your Code![]() Developers know that as a project gets bigger, and more complicated, it gets harder to keep the big picture in focus. The overall structure of the project can get obscured by the details in the code. Visual models can help snap the big picture back into focus and allow you to see the structure of your project. As well, they can let you see relationships between components that you might not have noticed otherwise. In other words, they let you look at the architecture of a project rather than just the nuts and bolts. Visual models can also give you a way to communicate the structure of a project to other people, including those that aren't as involved in a project as you are. You can take a class model to a colleague for an opinion about a solution to a problem. You can take a data model to a potential customer to make sure that you are solving their problem effectively. Or, you can even print out large diagrams of your project and hang them on the wall so that other people in your company can marvel in your project's progress. Xcode 2.0 introduces the ability to create and work with two kinds of visual models: Class models and data models. Class ModelsThe Xcode class modeler works with Objective-C, C++, and Java source code files and can give you a look at just a few classes, every class in your project, or even all of the classes in a framework. You can create quick one-off models to take a look at some part of your project, or you can create permanent models that are part of the project and which can be checked into and out of source control systems, such as CVS and Subversion. ![]() The class models that Xcode creates aren't just static representations. They are fully interactive. You can use them to navigate your code. Double-click on a property or operation and you will be taken right to the relevant code. You can also browse the documentation for system frameworks directly from the class model. The models also update in real-time according to changes in the source files that they are based off of. For example, if you add a method to a class, it will instantly show up in the Operations section of that class's diagram. Likewise, if you delete an instance variable from a class, it will be removed from the Properties section of the class's diagram. Once you have created a model you can zoom in and out of the diagram, change the colors of classes, move them around, set all of the classes to a consistent size, as well as tweak alignment. You are free to arrange things so that you can get the best picture of your code. Data Models![]() Data models go beyond graphically representing the class hierarchies in your application. Instead, they are a fundamental piece of Core Data, the new object-graph management and persistence framework that makes its debut in Mac OS X Tiger. Object-graph management allows you to work with the data in your application, including full undo and redo support. It also provides a well-defined data integrity infrastructure. Object-graph persistence means that the data in your application is automatically stored to, and then retrieved from, a file on disk. Very little code is actually required to take advantage of these features. Core Data can use a data model, also known as a schema, to define the data-bearing entities in your application and then manage and store those entities for you. It takes care of all of the details of mapping the data in a persistent store to instances of objects in your application. By creating these models graphically in Xcode, you can quickly and easily define your schema without having to create and edit large XML files or write a lot of tedious boilerplate code. Find Documentation FastOne of the most useful features of Xcode is the documentation browser. Using it, you can quickly browse the APIs for the various frameworks installed on the system as well as perform full text searches on the complete set of developer documentation installed in the /Developer/ADC Reference Library folder. In days gone by, you had to have a wall full of bookshelves to hold all the manuals needed to get your job done. Now, it all goes with you wherever you take your PowerBook. Making this great feature even more useful, Xcode 2.0 will alert you when new documentation in the ADC Reference Library becomes available. When that happens, you are able to download the new documentation to your local disk, updating your local copy. So you can always have access to the latest developer documentation even if you are working disconnected in an airplane at 35,000 ft. The documentation browser has also been upgraded to use SearchKit for its full text searches. This means that searches will be faster and more accurate. As well, Xcode 2.0 will include search indexes not just for locally installed content, but also for the documentation that is available on the ADC website and the ADC Developer DVDs. Work the Way You WantAsk any project team how they set up their programming workspace and you'll get about as many different answers as there are developers. Some prefer an all-in-one approach. Others want each and every function to be in a separate window. And of course, the size of a monitor affects these answers as well. The kind of development workspace that's perfect on a 23" Cinema Display in the office just doesn't translate to use on a smaller screen on an iBook at the corner coffee shop. ![]() Xcode 2.0 allows you to set up your workspace in a variety of different ways. You can use the new All-In-One layout and pack all of your coding into one window. The contents of the window change depending on whether you are editing, building, or debugging code. You can flip easily between these three groups using a toggle button. ![]() If, on the other hand, you yearn for a workspace that gives you a central palette from which you can open documents in their own windows, then the new Condensed layout is just what you are looking for. It gives you an entirely new way to work with your Xcode projects that won't be new to Code Warrior veterans. ![]() And, if you are happy with the way that Xcode works in version 1.5, never fear. You can use the Default layout in Xcode 2.0 and be right at home. Everything works the same way that you are used to and you get to take advantage of all the other great new features in Xcode 2.0. All of these choices in the way you lay out your workspace add up to one thing: The ability for you to work with your code in the way that works best for you. After all, you have a job to do. You tools should help you get that job done at both the office and over a latte. Power Through BuildsAt the very core of the Xcode 2.0 toolchain is the GCC 4.0 compiler, the next generation of the industry-standard compiler. This new compiler contains a number of advanced optimization techniques that are designed to make your applications fly. The most significant of these is the move to Tree SSA (Single Static Assignment) from RTL (Register Transfer Language). Tree SSA is designed to be both language and target independent and allows a level of analysis and optimization that is impossible with RTL. This brings state-of-the-art optimization technology to GCC and to all of your Xcode projects. The optimizations enabled or radically improved by Tree SSA are:
One of the most impressive of these optimizations is auto-vectorization. This technique, borrowed from the world of supercomputing, allows your code to easily take advantage of the Velocity Engine in the PowerPC G4 and G5 processors. In addition to these generated-code optimizations, GCC 4.0 features an entirely new C++ parser. The new parser is tremendously faster than the one in GCC 3.3 and will have a noticeable benefit when building C++ based projects. Dynamic libstdc++The ISO standardization of C++ has brought many changes and improvements, not the least of which is the C++ standard library. The C++ standard library provides a wide range of useful standard classes and functions, such as string, collections, streams, and algorithms. By leveraging the C++ standard library, you can spend less time reinventing the wheel and more time working on your application. The implementation of the C++ standard library on Mac OS X is provided by libstdc++, part of the GCC project. In order to use the C++ standard library in previous versions of Mac OS X, you had to statically link it with your application. In Tiger, libstdc++ is provided as a dynamic library. This means that your applications will be smaller and can leverage the latest improvements to the C++ standard library automatically.
|