Feb 01 ADC Direct
Volume Number: 17 (2001)
Issue Number: 2
Column Tag: ADC Direct
Tools for the Trade
By Godfrey DiGiorgi
The focus of this article is Apple's development tools. Apple has been working on a Mac OS X tool suite to address all facets of Mac OS X development needs and provide valuable options for all developers.
Recalling from the first article in this series, Mac OS X is all about choices: what to develop, what to take advantage of in this new state of the art operating system. From its UNIX - based kernel to its advanced object - oriented application frameworks, Mac OS X provides a wide variety of opportunities for new products, each of which presents a need for development tools support.
The Apple Developer Connection
(ADC) ensures the success of Macintosh
developers by supporting them at Apple events. During Macworld San Francisco, ADC members
displayed software and hardware products to
customers and received discounts on booth space and CPUs. ADC has similar programs in place for Macworld Tokyo, Macworld Paris, and many other shows.
ADC Members in Europe were recently treated
to a series of in-depth developer briefings. These
briefings, designed for developers who want to
make the move to Mac OS X by carbonizing their applications and plug-ins, covered topics such as Aqua, Carbon, Cocoa, Core OS, and Java.
Be sure to mark your calendar for Apple's Worldwide Developers Conference 2001, which
takes place in San Jose, California from May
21-25. Details and preliminary schedules will be available soon.
The first developer tool to highlight is Mac OS X reference documentation. In particular, developers wishing to understand and take full advantage of Mac OS X's capabilities should start by reading "Inside Mac OS X: System Overview", available from the Apple Developer Connection web site in the Mac OS X Documentation section, System Overview category:
http://developer.apple.com/techpubs/ macosx/macosx.html
This book will take you through the entire operating system from the kernel OpenSource layer (Darwin) to the Aqua User Experience and give you the system overview necessary to make development choices.
Let's say you've already chosen your development area; you have your product in mind; you know what you want it to do; you have chosen your development API set from the choices available in Carbon, Cocoa, Java, BSD or Kernel centric realms. In front of you is the next set of choices: What development tools will you use to achieve your development goals most effectively?
Both Apple Computer and third-party tool vendors have a long history of delivering Mac OS development tools which span the gamut: from high - level, easy to use, and fast to learn tools to commercially oriented, high - power tool suites that approach every kind of operating system component and application development. No less is true for Mac OS X. Apple has been working closely with third-party IDE and other tool vendors to bring their tools to Mac OS X, including Metrowerks' CodeWarrior Pro and Real Software's REALbasic along with many others. For a more detailed listing of available tools and URL links to their vendors, see the Development Tools page on the Apple Developer Connection web site:
http://developer.apple.com/tools/
Let's now take a brief look at Apple's development tools for Mac OS X.
Project Builder
Project Builder is Apple's integrated development environment (IDE) for Mac OS X. It is designed to fully support all of the major platform initiatives of Mac OS X, such as the Carbon and Cocoa frameworks, Java, I/O Kit and the application bundle mechanisms. It provides templates for quick creation of new projects; a few clicks of the mouse will create a starter project for an I/O Kit driver, a standard UNIX type tool, or a Cocoa or Carbon application. Everything that can be written for Mac OS X can be created with Project Builder including applications, tools, frameworks, libraries, plug-in bundles, down to kernel extensions and device drivers.
Project Builder provides project editing, search and navigation facilities, file editing, build system and target setup, and high - level debugging facilities. Language implementations allow development using C, C++, Objective-C and Java. CVS source code control system access is integrated into the user interface.
All of these features are built on top of industry standard tool components provided by Mac OS X, allowing for great robustness and compatibility with source code developed on many platforms. C, C++ and Objective-C compilers are the gcc compiler suite; Java is compiled with either javac from Sun's JDK or with the jikes compiler from IBM. The build system is based upon jam, a high performance 'make' with reduced maintenance requirements. Project Builder's debugger uses gdb providing both high level debug panes and direct access to gdb commands for any desired runtime inspection.
The design centers of Project Builder provide robustness and flexibility along with multi-user, multi-project capabilities. In order to keep project management and debugging clear and consistent, Project Builder uses a paned-window approach in its UI with growable/collapsible areas that allow maximized effectiveness when working in a specific area of its functionality. It can open separate editing windows when multiple files need to be available at the same time. Project Builder is also able to accommodate pre-existing and legacy projects, with support for makefile driven builds as well as CodeWarrior project imports.
Interface Builder
Interface Builder is Apple's user interface design tool for applications. Developers using its graphical editing environment can manage virtually every aspect of creating a well designed user interface that adheres to the Aqua user interface guidelines. It's great for prototyping and fast development changes.
Interface Builder understands all Carbon and Cocoa UI elements and produces 'nib' files that provide a modern way to manage and develop the static resources used by applications. Recent enhancements to Interface Builder include layout tools that use guides and distance measurement tailored for Aqua, a high degree of integration with Project Builder, and improvements in performance, stability, and "Undo" capability.
Interface Builder provides the easiest way to use advanced Carbon Events in the Carbon application development process and it is a highly tuned part of the Cocoa application development process through implementation of the Cocoa concepts of outlets and actions. By leveraging the AppKit and Foundation frameworks of Cocoa, Interface Builder provides a highly efficient rapid application development environment.
Interface Builder works with Project Builder to make application design and implementation more productive and to create highly reliable, good looking applications. Expect much more to come as Apple evolves these applications to take advantage of upcoming Mac OS X features.
Performance Tools
Mac OS X is a new operating system with new libraries and semantics that can differ in many ways from previous incarnations of Mac OS. There are different costs to the use of these APIs, often different algorithms are required to get the most out of your implementation. Apple has developed several performance analysis tools that are available to you now. Inspection capabilities that we have developed fall into roughly three categories:
- System State: memory, resource usage, system calls
- Execution Patterns: profiling and tracing
- Memory usage: tracing allocations and leaks
One group of these tools leverages the command line environment provided by BSD services and allows for minimally invasive ways to gather data about a running application. These include but are not limited to:
top - determine what tasks are executing and statistics
fs_usage, sc_usage - observe system call usage
At a higher level, there is Sampler for 'on the fly' profiling. This tool stops the program at intervals to see what's running, summarizes which functions and call traces were seen, and provides a statistical look at runtime operation. It requires no recompilation or source code changes to do its job. It's best for exploring an application's execution in large context; the command-line version, 'sample', is great for seeing why an application is hanging.
Discounts on Mac OS X Migration
Bring Your Apps to Mac OS X
With Mac OS X Public Beta here, and the commercial release just over the horizon, Mac developers everywhere have a huge need for Carbon and Cocoa application porting, Aqua user interface implementation, and driver development services. Several high-quality software engineering firms, in association with the Apple Developer Connection, are offering these services at very attractive discounts to all ADC Select and Premier members.
http://developer.apple.com/mkt/macosxmigration.html
A last tool to highlight here is MallocDebug. MallocDebug is intended to do memory heap analysis, answering difficult questions like:
- How much heap memory is a program using?
- Where has a buffer been overrun or underrun?
- Which functions request large chunks of memory?
- Am I leaking memory?
MallocDebug can tell you how much memory is used at specific times and identify the call stack leading to each allocation. It can also see all Carbon, Core Foundation and Objective-C memory allocations.
Use of these analysis tools can contribute to substantial improvements in application performance and reliability.
Delivery and Documentation ... where to go for more!
All of Apple's Mac OS X development tools are distributed on a companion CD to Mac OS X called the "Mac OS X Developer Tools CD". This jam-packed CD contains packages that install the applications, reference documentation and sample code into a Mac OS X configured system.
Documentation for tools and APIs is available from within running applications using the Mac OS X help system's "Developer Center" and in the form of HTML pages viewable with any browser. On a Mac OS X Public Beta system with the Developer Tools CD installed, see the file:
/Developer/Documentation/DeveloperTools/devtools.html
The first version of the Mac OS X Developer Tools CD was delivered in conjunction with Mac OS X Public Beta, mailed directly to all Premier, Select, and Student members of the Apple Developer Connection. A downloadable version was made available to all ADC Online program members. Future plans include similar distribution, and web-based component and documentation updates. Stay tuned for future announcements on these plans!
Summing up
Choosing your development tools is important. You should weigh the strengths of all the development tool options to achieve your implementation goals. Apple's tool suite provides a rich set of capabilities for Mac OS X development allowing you to access every feature of this new operating system and providing you with the broadest development flexibility.
Godfrey DiGiorgi is Technology Manager for Development Tools and Cocoa in Apple Worldwide Developer Relations. He's in his 8th year at Apple, having spent six years in Developer Technical Support as an engineer and manager. Godfrey has been involved with software development on Mac OS since 1984, working on Radar Imaging applications while at NASA's Jet Propulsion Laboratory and later in the chemical research industry as lead architect/engineer for a cross-platform application framework implemented on Mac OS. He also spent two years at Sun Microsystems as part of the team that developed the specification for the Java Card language platform.
Did You Know?
Finding API Information from Project Builder
Through integration with the Mac OS X help system, Project Builder makes it easy to look up reference documentation on functions, methods, structures, and other API symbols directly from your code. This feature is easy to set up and use.
- Index your project. Choose Index Project from the Project menu. Indexing caches the definitions of all project symbols, including those of imported frameworks and libraries. These symbols are also captured in the reference documentation as special tags embedded in the HTML.
- Search for definitions. Choose Show Batch Find from the Find menu (or click the Find tab) and, in the Batch Find pane, choose Definitions from the pop-up menu. Then type the name (full or partial) of an API symbol in the Find field and click the Find button. To look up a symbol directly from your code, select the symbol in your code and press Command-Shift-E (Find > Find Selection).
- Click the book icon. When you search for a symbol definition, Project Builder returns a list of all symbols that match what you entered. If documentation on the symbol is available, it displays a book icon next to the symbol. Click the icon to display the documentation in Help Viewer.
The Developer Help Center section of Help Viewer includes a feature allowing you to copy declarations and other code "snippets" into your project. Click the folder icon next to the declaration or example to copy it to the Clipboard. Then, in Project Builder, move the insertion point to the desired place in your code and paste the declaration or code example from the Clipboard.
New Mac OS X Related Releases
The following software is available from the Download Software
area of the ADC Member Site at:
http://connect.apple.com/
Latest CarbonLib SDK
The CarbonLib SDK provides all the files needed to begin Carbon development.
Apple MacApp 15d3
Apple MacApp 15d3 is an application framework for creating user-friendly, object-oriented applications for the Mac OS. This release includes support for building with Project Builder, a new framework of helper classes for Mac OS X's Core Foundation, and updates to a variety of Toolbox suites in ACS.
Developer Documentation
The following new and updated documentation is available to help you on your way to successful Mac OS X application and peripheral development at:
http://developer.apple.com/techpubs/
- Moon Travel Tutorial (Building a Simple Carbon Application)
- Providing User Assistance With Apple Help
- Handling Unicode Text Editing With Multilingual Text Engine
- Aqua Human Interface Guidelines
- Navigation Services for Carbon API Reference
- Managing Fonts With the Font Manager
- Programming With Language Analysis Manager
- Using Apple Japanese Analysis Engine and Access Method
- Programming With Dictionary Manager
- Rendering Library Preliminary Reference
- Carbon Specification
- Carbon Event Manager Preliminary API Reference
- Carbon Porting Guide
- Drag Manager Reference
- AGL Reference
- Games Sprockets Reference
- Power Manager Reference
- Matching Fonts With Font Sync
- Window Manager Reference
- Dialog Manager Reference
- Menu Manager Reference
- File Manager Reference
- Transferring Data With the URL Access Manager
- Implementing Security Features Using the Keychain Manager
- TN2009 - The Browser Control (aka That ListView Thing)
- TN2006 - MP-Safe Routines
- TN1128 - Understanding Open Transport Memory Management
- Q&A JAVA28 - Creating JNI Libraries With Project BuilderMac
- Q&A JAVA29 - Creating Mac OS X Applications From Java JAR Files
- SAMPLECODE - Networking: OTMP
- SAMPLECODE - Networking: DumpNetworkSetup
- SAMPLECODE - Overview: MoreIsBetter
- SAMPLECODE - Processes: CallMachOFramework
Carbon Tips & Tricks
The Apple Developer Connection web site now includes a Carbon "Tips & Tricks" web page dedicated to sharing special techniques for debugging and building Carbon applications.
http://developer.apple.com/macosx/carbon/tipsandtricks.html
Upcoming Seminars and Events
For more information on Apple developer events please
visit the developer Events page at: http://developer.apple.com/events/
Training and Seminars
Programming with Cocoa
Taught by Aaron Hillegass at the Big Nerd Ranch, Ashville, NC and Atlanta, GA. Five-day classes are taught on developing web-based and Mac OS X applications
http://www.bignerdranch.com/when.html
Developer Related Conferences
* MACWORLD Expo Tokyo 2001
February 22-24
Macworld conference and Expo Tokyo provides you with the ideal venue to introduce your company and products to over 200,000 eager attendees. Special exhibitor packages and hardware discounts for ADC Premier and Select members
are available.
http://developer.apple.com/mkt/mwtokyo2001.html
* Worldwide Developers Conference (WWDC) 2001,
San Jose, California
May 21-25
WWDC 2001, the definitive event for Mac software and hardware developers, is coming to the San Jose Convention Center a week later than usual this May. Mark your calendar now and read ADC Direct for updates.
http://developer.apple.com/mkt/