Objective-C in Linux

I am a big fan of the Objective-C programming language. Since I love it so much, it makes me frustrated to see people spread misinformation about it that isn’t true.

First of all, what is Objective-C? It is a programming language that allows a programmer to use objects in C.

How does it compare to C++? C++ and Objective-C were both created to allow for easier object oriented design. Even so, they are very different: C++ is a new language based on C, and is mostly compatible with C. Objective-C is C, but with objects.

Let me restate that. A program written in C might compile and run fine with a C++ compiler. With an Objective-C compiler, a C program will compile. It’s guaranteed, otherwise it’s not an Objective-C compiler.

So, what libraries are available for Objective-C? GTK+, Allegro, OpenGL, SDL, glibc, the Linux API… Any library written in C is by default an Objective-C library, and there are a lot of libraries written in C. A programming language may be considered as good as the libraries available for it, and as you can see, it would be silly for anyone to suggest that there are no libraries for Objective-C.

What about GNUstep? GNUstep is a toolkit, including GUI widgets, written in Objective-C. I haven’t used it.

Is Objective-C tied to Apple? Objective-C is a well defined language that is well supported by GCC. Realistically, Objective-C doesn’t seem to be used much nowadays except for Mac OS X and iOS applications. I have never written an application for an Apple product. Also, I don’t have any comments about Objective-C 2.0 or Objective-C++, because I haven’t used them.

Is Objective-C slow? It might be slower that C and C++, but not to the point where I think it matters, nor do I think anyone would be able to tell the difference. In my opinion, the ease of use more than make up for any loss in speed there might be.

Isn’t the syntax for calling a method in Objective-C is obnoxious? Nope. It’s just different, and certainly has its own benefits and drawbacks.

window->addButton(okButton, 50, 75);

[window addButton:okButton x:50 y:75];

Why would someone choose to use Objective-C? Objective-C can be compiled for all major operating systems. (for example, anything that supports GCC) It is a compiled language that produces executable files, just like C. It can natively use all C libraries. It is as “simple” as C, but with objects.

Comments are closed.