Bits, Bytes & The iPhone SDK

// September 5th, 2008 // iphone, mac osx, objective-c, programming

So I’ve been toying with the idea of building an application for the iPhone and yesterday I finally decided to download the SDK. After agreeing to give my soul to Apple as stipulated in their Terms & Conditions and 8 hours of downloading later I finally got the full SDK.

I have been trolling through their documentation and it looks like I will have to get my hands dirty in Objective-C. Which, from what I can tell, is a slightly cleaner version of C++ specifically designed for Mac OSX. In case you didn’t know, the iPhone runs on a heavily modified version of the Mac OSX kernel. This has its benefits in that by learning to program for the iPhone I will also slowly become accustomed to writing programs for Mac.

The easiest way to learn a programming language is to remember that they are all essentially the same. Don’t get confused between a programming language and a markup language. I can’t tell you how many times I have read on programmer resum├ęs that HTML is a programming language. HTML is a markup language – a way of describing visual data in a hierarchical textual fashion. A programming language is a set of statements that can be executed sequentially and all procedural programming languages follow a similar set of rules and contain 3 specific constructs:

  1. Variables
  2. Conditional statements
  3. And Loops

With these three constructs it is possible, with great pain I might add, to build any program.

Of course a programming language is of no use if there is no way of interpreting it. Way back in the days before Microsoft and Apple, programs were created on punch cards – pieces of cardboard with rows of holes punched in them. Every hole represented a 1 and every non-hole represented a 0. The punch cards were fed through the computer which would read the rows sequentially and then execute them. Punch cards are so old they were first used back in the 18th century to control weaving looms and were used up until the last century still.

So-called ‘modern’ computers work in much the same way. High-level programming languages such as C++ and Java are compiled by another piece of software, called a compiler and converted to what is known as Assembly Language. Assembly language is a low level language used to program hardware, such as your computer’s CPU. Assembly code is then converted to what is known as Object Code. Object Code is the final sequence of 1s and 0s – the holes and non-holes on punch cards.

Every single computer program you use is constructed in this way. So next time you get the dreaded ‘blue-screen-of-death’ or your e-mail application crashes, just remember how many 1s and 0s are moving through the system. A modern car consists of approximately 12000 parts. Microsoft Windows XP consists of approximately 1 billion lines of code and it works 99% of the time. That is absolutely incredible!

I guess what I am trying to say here is that learning how to program within the iPhone SDK and learning Objective-C is trivial compared to building an operating system like Mac OSX or programming a computer’s CPU. It’s made even easier if we remember that all procedural programming languages are constructed out of similar building blocks and that if we learn and understand the basics of a subject we can go on to learn just about anything.

Leave a Reply