Feeds

Making the move to the Mac

Mac development for Windows programmers

Choosing a cloud hosting partner with confidence

As should be pretty clear from previous ramblings, I've about given up on Windows and am in the process of trying to reinvent myself as a Mac developer (I should perhaps say re-reinvent myself, since I worked with Macs back in the early days of the original 128K Mac, over 20 years ago).

Things are going pretty well so far, and if I could only resist the temptation to disassemble bits of the AppKit framework whenever I have an idle moment (see here for more on my strange personal habits) then I might actually have had a shareware application or two out by now.

This article is aimed at Windows developers who are considering making the move. The idea is to get you up to speed as quickly as possible with mainstream Mac development. Rather than discussing cross-platform programming techniques and toolkits (the subject of previous articles), I'm going to focus unashamedly on Cocoa and Objective-C. I'll assume only that you're coming at things from a RAD perspective: Delphi, WinForms on .NET, or maybe even "classic" Visual Basic. Think of this article as a "Dummmies Guide" to Mac programming if you like. All I'm trying to do here is cover the basics using terminology that should already be familiar to a Win32 RAD developer.

As with many development environments, the two most critical components in the Mac development equation are the programming language and the class library/libraries; we'll look briefly at these first.

Objective-C

Having bought out NeXT, Apple ended up with the OpenStep development system, hence the emphasis on Objective-C. For those who haven't used Obj-C before, it's basically a superset of C with object-oriented extensions. The syntax of the OOP extensions is rather esoteric for those unused to it. For example, to call a method taking three arguments in C++, we'd do this:

someObject->drawCircle (20.0, 27.0, 5.0);

To do a similar thing in Objective-C looks like this:

[someObject drawCircleAtX: 20.0 Y: 27.0 withRadius: 5.0];

Objective-C developers prefer to talk about sending a message to an object rather than calling a method. Notice that the name of the message (in this particular case, 'drawCircleAtX:Y:withRadius:') is arguably more self-explanatory than the C++ example because the meaning of each argument – preceded by a colon – is made clear; proponents claim that you end up with code that's more descriptive, but against this, you'll get much more verbose syntax.

Personally, I like Obj-C more than I did when I started using it, but in the gcc compiler the integration of Obj-C syntax leaves something to be desired. Leave off one of those all-important colons, for example, and you will get an unhelpful error message from a very confused parser. Put simply, part of the rationale behind the language syntax (aside from the language designer's fondness for Smalltalk) is to necessarily disambiguate the object-oriented extensions from the underlying C syntax. The brackets and colon symbols are compiler hints, if you will, which tell the thing whether it's looking at an Obj-C method call or a chunk of plain-vanilla C.

The whole thing is potentially more dynamic and reflective than many programming languages because, for example, an efficient mechanism exists for asking a particular object whether it handles some message before sending the message to the object.

Intelligent flash storage arrays

More from The Register

next story
Netscape Navigator - the browser that started it all - turns 20
It was 20 years ago today, Marc Andreeesen taught the band to play
Sway: Microsoft's new Office app doesn't have an Undo function
Content aggregation, meet the workplace ... oh
Sign off my IT project or I’ll PHONE your MUM
Honestly, it’s a piece of piss
Return of the Jedi – Apache reclaims web server crown
.london, .hamburg and .公司 - that's .com in Chinese - storm the web server charts
NetWare sales revive in China thanks to that man Snowden
If it ain't Microsoft, it's in fashion behind the Great Firewall
Chrome 38's new HTML tag support makes fatties FIT and SKINNIER
First browser to protect networks' bandwith using official spec
Admins! Never mind POODLE, there're NEW OpenSSL bugs to splat
Four new patches for open-source crypto libraries
prev story

Whitepapers

Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Cloud and hybrid-cloud data protection for VMware
Learn how quick and easy it is to configure backups and perform restores for VMware environments.
Three 1TB solid state scorchers up for grabs
Big SSDs can be expensive but think big and think free because you could be the lucky winner of one of three 1TB Samsung SSD 840 EVO drives that we’re giving away worth over £300 apiece.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.