1
You and This Book

Let’s talk about you for a minute. You want to write applications for iOS or OS X, but you have not done much (or any) programming in the past. Your friends have raved about other Big Nerd Ranch books (like 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? We have been teaching people how to write applications for iOS and the Mac for a long time now, and we have identified what you need to know at this point in your journey. We have worked hard to capture that knowledge and dispose of everything else. There is a lot of wisdom and very little fluff in this book.

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

Because of this approach, we are 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 new 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 having to think about a particular CPU, you can express the instructions in a general way, and a program (called a compiler) will transform that code into highly-optimized, CPU-specific machine code. One of these high-level languages is C. C programmers write code in the C language, and a C compiler 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 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 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