Understanding Programming is by far the best foundation you can build for yourself in order to make iPhone Apps or any apps for that matter. It does not have to be complicated. Besides watching an entry-level tutorial, If your desire is to build iPhone applications, it is a good idea to learn the language and get familiar with the development environment. The iPhone SDK comes with an IDE or integrated development environment that allows the developer to create applications in one of two ways:
- Writing code from scratch or
- Creating applications visually using the Interface Builder.
With the Interface Builder the user can literally drag and drop application elements into their program. With built-in objects, if a developer wanted to create an application containing several buttons that did something when the buttons were clicked, then all that is required is to drag the set number of buttons onto the application window from the object library, connect the objects to the part of the interface responsible for handling the code, and then writing the code or ‘assign an action’ to each of the buttons. For now, just concentrate on learning the terminology. I’ve included a list of terms broken down in my own words to get you going.
Knowing how to “talk-the-talk” before you start to “walk-the-walk” will help you be able to talk to other programmers and understand technical terms related to honing your craft of iPhone Development.
Before we get started, I’ve listed a couple of recommended resources below. Feel free to check them out to advance your knowledge even further.
Learning To Program: Recommended Books
Frameworks – a file which contains a collection of prewritten program code for used to create standard features and functions of the iphone
- UIKit: The UIKit Framework is a collection of all the code that causes the iphone user interface to display and perform basic functions
- MediaPlayer: The MediaPlayer Framework is a collection of all the code that allows you to write instructions to control audio and video. If you want to create an app that plays video, you would need the MediaPlayer Framework.
Source code – is all of the written programming code which makes up your entire application; the SDK and the Apple Dev Center contain quite a bit of sample code or source code. When you think about source, source is where things originate from. The source is the underlying substance of what your program is made up of no matter what language it is written in. Developers can sell or license their “source code” to other companies who want to create their own similarly functioning apps. This saves development time.
Open Source – is code that is shared freely among developers. Developers can add their own modules or improvements to the source. Users can download the software and use it freely with the understanding that the software isn’t perfect. It is a work in progress. You can find almost any kind of software available Open Source including graphics software. Good examples of these kinds of programs are Open Office, Gimp, Joomla, and WordPress, just to name a few.
Objective-C – is the programming language that the iPhone apps are written in
Object – An object is a thing. An object in a program does something. A button is an object, a slider is an object . . . A good example of how objects are used is in games. You have all the game controls that “do” something different. If you want to shoot your target, you use the object that performs the shooting. If you want to “move” you use an object that allow you to move. If you want to “display” or view the score, you use the object that allows you to see the score. Objects are reusable. When combined, they create your entire program. You can think of objects as little sections of code or instructions.
Syntax – is the rules of writing for any programming language; kind of like punctuation and grammar rules in English. It requires you to write the code a certain way. The syntax is different for each programming language. However some syntax is closely similar to syntax in another language. Errors occur if the syntax is wrong. Common syntax errors are:
- A missing semi-colon
- A missing curly bracket, etc.
Classes – A good way to describe classes in Xcode is that they consist of the interface description and the implementation instructions. These files describe your interface and program instructions to Xcode and the Interface Builder. When you create a project it automatically creates two files that make up the class. The filen ames end in .h and .m.
.h – header file – is where all of your ‘objects’ are “declared” or “created.” Here is where you give your newly created objects a name within the application. When you create objects in an application, in order for them to be used, they have to have a name for you to reference them by. This is necessary so that whenever you get ready to use an object, you would know what to call it. The main application does not recognize an object that was not declared or defined in the header file.
.m – implementation file – is where you program your actions. If you have a button defined as part of your app, here is where you would write the instructions for that button. The instructions are referred to as ‘actions.’ Makes sense doesn’t it?
methods – similar to actions. Methods can be pre-written or created from scratch. An example of an action or a method you may want to create is “addItem.” Whenever you want to say, add an item to a list, you would use this method. It can be assigned to a button, it can happen when you swipe your screen, or it could be “called” at a certain point in your program when you want the “add item” action to be performed. You control how you want the action to occur.
declaration – where you first define, “declare” or name an object in your application; this is done at the very beginning of the file, usually the header file or the head of the file. If you don’t declare an object, it won’t be recognized when you get ready to use it.
keyword – special word phrases that are a part of a programming language. They are pre-written or defined terms reserved for specific purposes within a language. You would refrain from using keywords as variables or methods that you create from scratch because they are already defined as part of the programming language. Some languages refer to them as reserve words. For instance, if “addItem” were already pre-defined function, you would need to name your method or function something different or you would get an error.
variable – holds information or data of a certain type: number, integer, text, etc. When you declare or create a variable you have to give it or assign it a ‘type.’ What type of information will your object handle? Will it handle text, numbers, integers? When you do this you are telling the program what kind of information this variable will contain and the program then knows how to process it. Variables can be created to hold information that the user types in, or they can store information that is processed by a calculation or some other performance that happens within the application. In short, variables hold data until it is time to do something with it. In the iPhone SDK variables are known as Outlets.
properties – describe physical attributes of object: color, size, orientation, etc.
string – text that will be displayed or output in an application
protocol – rules (that are conformed to)
If you enjoyed this brief lesson on understanding programming. You can learn more by signing up for the free 5-part Make A App mini-course on the right or get the eBook that covers making an app from concept to publish and comes with online instructional videos. Or to learn more about programming Click Here for a detailed course to get you on your way to mastery.