macworld news antenna

Leopard, from a developer’s perspective

However, the most influential faction of the Mac family of programmers is the one that confidently follows Steve Jobs’ vision of a Mac platform mixed with Unix and NeXT’s object-oriented development environment and derived tools. These developers use Objective-C, a native language compiled with dynamic properties; Cocoa, the core framework that is the object-oriented API of the Mac platform; and Apple’s Xcode integrated development environment. These developers write most of the commercial software available for the Mac, both inside and outside of Apple.

With Leopard, Apple wants to ensure that developers can create applications that exploit the full potential of the Mac platform, starting with Xcode 3.0 which includes substantial improvements over Apple’s free and official IDE. Xcode will be available publicly with Leopard, and currently only to paid members of the Apple Developer Connection.

Polishing Xcode 3.0

IDE editors tend to get overloaded with new features quite frequently, so I was skeptical when I learned that Xcode 3.0 would undergo a major editor redesign. However, the changes made by Apple are focused on consolidation and not on adding complexity to the product. Furthermore, the new editor will be well received by developers who are not very prone to cluttered environments with toolbars and multiple edit / compile / debug modes.

Considering that most Unix programmers live in their editors, Apple has decided to incorporate much of the functionality of a traditional IDE into the editor itself. For example, after compiling a project, the developer will be able to view errors and warnings in the code itself without having to access a compilation message window.

Now balloons are responsible for directly marking the position of errors. During the debugging phase, the editing window becomes the interface that allows you to explore the different symbols at runtime, as well as allowing the definition and deletion of simple and conditional breakpoints. During the actual editing process, Xcode 3.0 also provides interference-free enhancements through the Research Assistant and Code Cense features.

The Code Sense autofill feature is familiar to most IDE users, but in Xcode 3.0 it now features a drop-down list of completion options, with options that are reduced as the user continues to type.

The new Xcode code templates are a very interesting starting point in which later we will only have to fill in the parts of the code that change in each case. The Research Assistant feature, which works in its own window, displays a summary paragraph of the online documentation for the selected keyword.

Other interesting features for developers new to the Mac, and probably object-oriented development as well, are the improvements made to the editor when it comes to handling files with a good amount of code. Apple indicates that opening and scrolling through these types of files is around 10 times faster than previously.

Finally, Xcode also incorporates the code folding feature whereby sections of code (such as a function or object definition) can be folded, as well as code highlighting that allows you to differentiate logical blocks of code by shading.

Beyond the editor, Xcode 3.0 incorporates a good number of features designed from scratch and that are difficult to find in free environments, especially when we consider that they were not previously available for Objective-C. One is refactoring, and it allows a simple code change to be reflected throughout the project automatically. Xcode’s refactoring capability avoids the need to find and replace the change in each of the affected files after classes have been modified or renamed. It also updates the current Objective-C code to take advantage of the improvements related to Objective-C 2.0.

Finally, Xcode 3.0 further strengthens the integration of the IDE with third-party SCMs (source code management). Developers can validate files and projects, create new branches of source code, and import and export files to and from SCM. For projects that do not require all the features of an SCM and to recover from unintended modifications to files, the Project Snapshots feature allows you to capture the state of a project acting as a kind of “global undo” that can be applied after that something has gone wrong.

Updated Objective-C

Objective-C 2.0 is an “official” language update for the Mac platform. Apple recognizes that the language can be a steep learning curve for C, C ++, and Java developers, so it now incorporates features that are more in line with the experience of C and C ++ programmers.

The most important of these features is garbage collection. The main concern of developers is the need to manually perform memory management during the course of an application’s operation. This is a big challenge if we consider that objects move by reference. Garbage collection solves this problem by performing automatic memory management, checking for itself when it is no longer necessary to keep a reference to objects. The trade-off is that it reduces performance very slightly, but nothing compared to having to resort to dynamic languages ​​like Java or C #.

Objective-C 2.0 adds the “for” keyword, which greatly simplifies the enumeration between objects in a collection. It also adds object properties, a technique that I have learned to appreciate in JavaScript that allows the creation of new member variables using the object.member syntax.