1
You and This Book

Let’s talk about you for a minute. You want to write applications for iOS or Mac OS X, but you haven’t done much (or any) programming in the past. Your friends have raved about my other books (iOS Programming: The Big Nerd Ranch Guide and Cocoa Programming for Mac OS X), but they are written for experienced programmers. What should you do? Read this book.

There are similar books, but this one is the one you should read. Why? I’ve been teaching people how to write applications for iOS and the Mac for a long time now, and I’ve identified what you need to know at this point in your journey. I’ve worked hard to capture that knowledge and dispose of everything else. There is a lot of wisdom and very little fluff in this book.

My approach is a little unusual. Instead of simply trying to get you to understand the syntax of Objective-C, I’ll show you how programming works and how experienced programmers think about it.

Because of this approach, I’m going to cover some heavy ideas early in the book. You should not expect this to be an easy read. In addition, nearly every idea comes with a programming experiment. This combination of learning concepts and immediately putting them into action is the best way to learn programming.

C and Objective-C

When you run a program, a file is copied from the file system into memory (RAM), and the instructions in that file are executed by your computer. Those instructions are inscrutable to humans. So, humans write computer programs in a programming language. The very lowest-level programming language is called assembly code. In assembly code, you describe every step that the CPU (the computer’s brain) must take. This code is then transformed into machine code (the computer’s native tongue) by an assembler.

Assembly language is tediously long-winded and CPU-dependent (because the brain of your latest iMac can be quite different from the brain of your well-loved, well-worn PowerBook). In other words, if you want to run the program on a different type of computer, you will need to rewrite the assembly code.

To make code that could be easily moved from one type of computer to another, we developed high-level languages. With high-level languages, instead of thinking about a particular CPU, you could express the instructions in a general way, and a program (called a compiler) would transform that code into highly-optimized, CPU-specific machine code. One of these languages is C. C programmers write code in the C language, and a C compiler then converts the C code into machine code.

The C language was created in the early 1970s at AT&T. The Unix operating system, which is the basis for Mac OS X and Linux, was written in C with a little bit of assembly code for very low-level operations. The Windows operating system is also mostly written in C.

The Objective-C programming language is based on C, but it adds support for object-oriented programming. Objective-C is the programming language that is used to write applications for Apple’s iOS and Mac OS X operating systems.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset