Objective-C is a Beautiful Language

So, the truth comes out: I asked Matt to write his post on the history of Objective-C for me. Here’s why:

Initially I wanted to write a post on how Steve Jobs did not let anything he touched come out ugly, and Objective-C was no exception. However, Matt informed me that Jobs really did not have that much to do with the development of Objective-C, so now I just have to go off of how pretty of a language it is.

Matt did a great job explaining the fundamentals of object oriented programming, for those of you who don’t know, however, there are many different languages that accomplish object oriented programming. Objective-C, C++ and C# are all based off the libraries of C, but then there’s more as well, one of which is called Java (which is based off C, but written with complete cross platform capabilities in mind.)

Now, over the course of this experience with Matt, I’ve become pretty adept in Objective-C, and through classes and other reading, I’ve become well versed in C++ as well. Let me show you two lines of code that mean the exact same thing, in the different languages.

double volume = calculateVolumeOfCylinder(23, 4);

double volume = [self calculateVolumeOfCylinderWithHeight:23 andRadius:4];

Line 1 is written in C++, and line 2 is written in Objective-C. Both lines start out the same, declaring a variable of data type double, the equal sign signifies that we will be placing the value of the second expression into the first, and here’s where things get different. Looking at the C++ code, could you tell me off the bat what is going on? Sure, you could assume that since the function is called calculateVolume that the numbers will be used to calculate the volume of a cylinder, but what belongs to what? Hopping down to the Objective-C code, it is easy to tell exactly what the function will be doing, and what numbers will be used where! Sure, the code is a bit lengthier, but it is written in a way that we can read and understand better.

This is why I call Objective-C such a pretty language. All the functions, everything is written in a way that can easily be compared to English. This makes it quick and easy to debug, as long as you stick to the convention when you write your own classes and functions. The same cannot be said about C++, when I look at a file of C++ code, all I see is an abundance of parenthesis and numbers without context.

If you made it this far, I’m impressed. I threw quite a bit of techno mumbo jumbo at you. To summarize, I’m happy to be working with a language that has as many strengths as Objective-C does. While it may not be cross platform, I feel like it has been a great step into programming, as the logic and code match up and are easy to follow.

Thanks for reading,