macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Glossary for Seth Roby's Cocoa Series

by Seth Roby
08/01/2003

This is the glossary for "What's Your Function?", tutorial #2 in Seth Roby's ongoing Cocoa series.

Argument

The bits of data that are given to a function to work with (its input). During the function call, they are listed inside of the parentheses. During the function definition, they are defined with types and names inside of the parentheses.

Argument Passing

The term used for giving values to the arguments in a function you are calling. For example, in

myFunction(3+2, "Simon");

the arguments are being passed as 5 and the string Simon.

Assignment Operator

The equals sign, one example of an operator. This takes everything to the operator's right until a semicolon, evaluates it, and sets the variable that is to the immediate left of the operator to that value. First seen in lesson 1.

Bit

A one or a zero. A group of eight is a byte

.
Block

A section of code between an opening curly brace ({) and a closing curly brace (}). These can nest, so you can have a block inside of another block. In general, a block can replace any line of code.

Build

The name that the developer tools give to compiling code.

Byte

A group of eight bits

.
C String

A type of string that is often used by C.

Character

A type that represents one letter, number, or symbol that can be written with a keystroke.

Comment

In code, a part that is meant to be read only by humans, and not to have meaning to the compiler. Like whitespace, the compiler simply ignores comments, which lets you put anything you want in them.

Compile

Translating the code you wrote in half-English, half-computerese into full computerese, called machine language, which the computer understands and can run.

Compiler

A program on the computer that translates your code into machine language. Does the compiling.

Compile Time

The time when the compiler is translating the code to machine language so that it can be run.

Constant

Data that could be in variables that is instead typed directly into your code. Numbers and strings are the most common variable types that are expressed as constants.

Conversion Specification

A special string that contains a percent character and then a letter or number that defines a type. Used in format strings to determine how to describe the output string.

Disclosure Triangle

A standard widget that no one ever knows the name of. The little triangle that accompanies folders to show if they are expanded of not.

Developer Tools

The programs that Apple makes available to developers so that they can program for the Macintosh. The primary developer tool in versions of Mac OS X up to Jaguar was Project Builder, and after that it became Xcode.

Error

A message that the compiler will give you when you have code that does not compile. Unlike warnings, you cannot run your code if you have errors.

Errors are usually displayed by the developer tools in red.

Escape Sequence

A string used to represent characters not normally available as keystrokes. In C, these begin with a slash character (\) and are followed by another character that distinguishes which character the sequence stands for. \n is a new line, \t is a tab. There are many more.

Evaluate

To call all functions and substitute in all variables' values. This happens at run time.

Format String

A special type of string that describes a string, by including conversion specifications inside of it. Used by printf(), NSLog(), and many other functions.

Function

A section of code that can be called from other code. In C, you must declare the function before any code that calls it (or get a warning), and define the function somewhere in the code (or get an error).

Functions take inputs called arguments that can change how they work internally.

Functions have an associated block of code called the function body that defines the code that the function does.

Functions can return a value of any type to the code that calls it.

Note that functions have a distinction between declaration and definition, whereas a variable has none; declaration and definition are identical.

Function Call

A means by which one part of a program can call another part of a program. This makes it easy to use the same code over and over again, without having to rewrite it over and over again. Uses a syntax such as

name(argument1, argument2),

where the function's name precedes the parentheses, and all arguments are listed in the parentheses and separated by commas.

Function Body

The block of code in a function definition that defines the code that that function executes.

Function Declaration

A line of code that tells the compiler that a function exists, so that the compiler will not complain if you use that function. Has the form:

returnType functionName(argType argName1, argType argName2);

This can usually be copied and pasted from the function definition.

Function Definition

Code that defines exactly what a function does. Has the form:

returnType functionName(argType argName1, argType argName2) {
	//function body
}

When the function is called, the arguments are implicitly defined in the function body, and take on the values passed into them by the function call.

Imperative Language

A programming language where the programmer tells the computer what to do in a specific order, one statement after another. C is such a language.

Input

The information that goes into a function, program, etc. The opposite of output.

Integer

A type that represents a whole number, without any decimal part. Declared with the keyword int. 5, -23, and 17,000 are all integers, while 2.3, .9, and pi are not. An integer can optionally be unsigned, which means that it must be positive.

Line Number

A way of referencing a specific line of code. Line numbers always begin at the start of the file with the first line numbered "1". You will often see line numbers in the format MyKeenFile.c:23, with the filename before the colon and the line number of that file after it. In the Developer Tools, the line number is displayed at the top of any editor window in this format.

Operator

A token that has a special meaning to the compiler. Operators are the verbs of C, and they act on the other tokens around them.

Output

The information that comes out of a function, program, etc. The opposite of input.

Project

The name Apple's Developer Tools gives to a program under development. When you create a project, the developer tools create a folder for any code files to live in, as well as a project file (which is really a package). Any support files will also go into this folder.

Project Builder

The primary Developer Tool for versions of Mac OS X up until Panther's release. Formerly known as ProjectBuilder (no space).

Return

The act of a function giving its results to the code that called it. Every function returns the type of data it is defined to return. Use the command return to accomplish this. It is good practice, though not required, to have return on the last line of the returning function.

Run

Making your code do whatever it is your code does. Once the code is compiled, the computer can run the code like it runs any other application. You can even go into the terminal and launch the code.

Run Time

The time when the program is actually running, after all code has been compiled.

Snippet

A section of code, usually when offered to someone. Can be a block, but doesn't have to be.

String

A list of characters that make a bit of text.

Token

In code, everything that is not whitespace is a token. Each section of text between sections of whitespace is a separate token. This is a more general term than "word," because an equal sign is also a token, but might not be counted as a word by some.

Type

A way of interpreting data. Every variable has a type that tells the computer how to interpret the bits that the variable really represents. There are many different types defined in C, and the programmer can define his own types as well.

Variable

A section of memory that is set aside to hold some specific information. Variables are created with a variable definition, and afterwards are referenced by name, which much be one token. Every variable has a type assigned to it, to tell the computer how to read the variable.

Variable naming in C follows a standard that takes all of the words in the name, capitalizes them, and takes out the spaces. The first letter is not capitalized. So a variable that represents the "Number Of Doodads to Make" would be called numberOfDoodadsToMake. Note that this is not a requirement, but it makes your code easier to understand to the rest of the world.

Variable Assignment

A line of code that assigns a value to an already-created variable.

Variable Declaration

A line of code that creates a variable with a specific name and type. It can be combined with a variable assignment in the same line.

Variable Definition

See variable declaration. Note that variables make no distinction between declaration and definition, because once a variable has a name and a type, it is declared and defined, whereas a function must have separate declaration and definition.

Warning

A message that the compiler will give you when it detects something possibly wrong with your program. A warning is not definitely a problem, but it indicates a questionable bit of code, and the compiler is telling you to watch out. Unlike errors, you can still run code that generates warnings, but it may lead to errors or crashes in your code at run time.

Whitespace

Spaces, tabs, and returns are collectively referred to as whitespace. In code, whitespace is ignored by the compiler, and so can be used to delineate sections of code, or make code more readable to people.

Xcode

The primary developer tool provided by Apple, starting with Panther.



Seth Roby graduated in May of 2003 with a double major in English and Computer Science, the Macintosh part of a three-person Macintosh, Linux, and Windows graduating triumvirate.

Return to "What's Your Function?", tutorial #2 in Seth Roby's ongoing Cocoa series.

Return to the Mac DevCenter.