Programming Glossary
Info
Note: This came from Programming for Beginners.
algorithm
- (noun) a step-by-step procedure to achieve a specific goal. Can be implemented with code.
Example: I used the quicksort algorithm to sort the array alphabetically.
argument
- (noun) a value that is passed into a function when it is called. Arguments are said to be “passed” into a function, and functions are said to “take” arguments. Also known as a “parameter.”
Example: That function takes two arguments.
array
- (noun) a type of value that contains a sequence of other values.
Example: I put all our names into an array of strings.
assignment
- (noun) the act of putting a value into a variable.
Example: I assigned the number 22
to the age
variable.
brackets
- (noun) characters often used to surround text. The different types of brackets are:
Parenthesis/parens/round brackets:
( )
Curly brackets/braces:{ }
Angle brackets:< >
Square brackets:[ ]
The bracket at the beginning is called the “opening” or the “left” bracket. The bracket at the end is called the “closing” or “right” bracket.
Example: Your code won’t compile because you forgot a closing bracket.
bug
- (noun) a mistake in a program.
Example: There must be a bug because the output is wrong.
call
- (verb) to run the code in a function. Also referred to as “running,” “executing,” or “invoking” a function. For the noun, see function call.
Example: I called the rand
function and it returned 42
.
class
- (noun) a type that can be defined by the programmer. Classes are defined in order to create objects of that class. See object
Example: I made a Person
class that holds a person’s name and age.
comment
- (noun) arbitrary text written around code, but which is never run, and is generally ignored by the computer. Used to leave notes and documentation for people who read the code later. Also used to stop code from running (see comment out).
Example: I wrote comments in my code so I could understand it later.
comment out
- (verb) to turn code into a comment so that it does not get run.
Example: I commented out this line of code, and it doesn’t crash any more.
compiler
- (noun) a program that converts code into an executable, and checks that the syntax is correct. Sometimes compilers convert code into other code.
Example: The compiler is giving me an error, so I must have incorrect syntax somewhere.
constant
- (noun) a variable that never changes its value.
Example: The PI
constant has the value 3.14
.
crash
- (verb) to cause a running program to stop due to an error.
Example: I tried to divide a number by zero, which made the program crash.
data structure
- (noun) a value that contains other values.
Example: Arrays are one kind of data structure.
debug
- (verb) to investigate and fix bugs.
Example: I spent all day debugging a complicated error.
declaration
- (noun) code that declares that something exists – usually a variable, function or a class. A declaration might not fully define the thing it is declaring. E.g. a constant may be declared to exist, without actually defining what it’s value is. Not all programming languages allow for declarations.
Example: My code won’t compile because I wrote a function declaration, but I forgot to write the actual function.
definition
- (noun) code that fully implements something – usually a variable, function or a class. The code that implements a class is called the “class definition.” The code that implements a function is called the “function definition.”
Example: The function wasn’t doing what I expected, so I had a look at its definition.
double
- (noun) a float that can represent a wider range of numbers than a normal float. Short for “double-precision floating-point number.” See float.
Example: The number was so tiny I had to use a double
instead of a float
.
execute
- (verb) Synonym for run.
Example: I can’t execute my program because it won’t compile.
executable
- (noun) a program, usually a single file, ready to be run.
Example: Give me the executable so I can try out your program.
float
- (noun) a type of value that represents numbers with fractional parts. Short for “floating-point number”.
Example: The value 3.14
is a float.
function
- (noun) a piece of code that is not run until it is called. Functions take zero or more arguments. When a function finishes running, it returns a return value back to the code that called it.
Example: I wrote a function that takes an array of numbers as an argument, and returns the average.
function call
- (noun) code for calling a function. Function calls specify which function to call, and all of the arguments that the function requires. The result of a function call is a return value. Not all functions have a return value.
Example: The function call add(1,2,3)
returns the value 6
.
implement
- (verb) to write all the code to complete something – usually a function or a class.
Example: I finished implementing those functions.
instance
- (noun) Synonym for object.
Example: I created an instance of the Person
class.
instance variable
- (noun) a variable that is attached to an object. Also known as a “member variable” or just a “member.”
Example: On the tom object, I assigned the value "Tom Dalling"
to the name
instance variable.
instantiate
- (verb) to create an object from a class.
Example: I instantiated an object of the Person
class.
integer
- (noun) a type of value that represents whole numbers. For fractional numbers, see float.
Example: 42
is an integer value.
interpreter
- (noun) a program that runs code. For languages that are not compiled, the source code is run directly by an interpreter. Compiled programming languages do not usually have an interpreter.
Example: I installed the Ruby interpreter so I can run my Ruby code.
invoke
- (verb) Synonym for call.
Example: I invoked the function with the wrong arguments, and it crashed.
iterate
- (verb) Synonym for loop.
Example: I iterated over all the values in the array.
loop
- (noun) a piece of code that runs itself repeatedly. Commonly used to run a piece code for every value in an array. Also known as “iteration”.
Example: The code loops until the user types in "quit"
.
member function
- (noun) Synonym for method.
Example: This class has three member functions.
member variable
- (noun) Synonym for instance variable.
Example: This class has two member variables.
method
- (noun) a function that is attached to an object. Methods belong to, and are defined in, a class. Also known as a “member function.”
Example: The length method returns the number of characters in a string object.
nested
- (adjective) contained within something like itself. E.g. a nested array is an array that is inside another array, and a nested class is a class defined inside the definition of another class.
Example: I used a nested loop to loop over a grid – the outer loop for the x coordinate, and the inner loop for the y coordinate.
object
- (noun) a value created from a class. E.g. If you want to represent your family in code then you might make a class called FamilyMember, and create several objects from that class – one object for each person in your family.
- Objects usually contain other values inside instance variables, and have methods attached to them. E.g. each FamilyMember object might have a name instance variable. Objects combine the concept of variables and functions into a single value. Also known as an “instance.”
Example: I make the enemy move by changing the position instance variable of the enemy object.
object-oriented
- (adjective) designed using objects.
Example: Ruby is an object-oriented programming language because all values are objects in Ruby.
parameter
- (noun) Synonym for argument.
Example: That function takes two parameters.
parenthesis
- (noun) A type of bracket.
Example: Lisp-like programming languages use a lot of parenthesis in their syntax.
procedure
- (noun) Synonym for function.
Example: That procedure takes two arguments.
program
- (noun) a full piece of software that is ready to be run. Usually an executable.
Example: I wrote a program that keeps track of my todo list.
read
- (verb) to retrieve input data values from an external source – usually from a file. Can refer to retrieving data over a network, such as the internet. The opposite of writing.
Example: I read the contents of file into a string.
return
- (verb) to immediately stop a called function from running, possibly providing a return value. A function automatically returns once all of its code has been run. However, the code in the function definition can force the function to return at any point.
Example: If the array is empty, the function returns early without running the rest of its code.
return value
- (noun) the value that results from a completed function call.
Example: The return value of the rand function is a random float between 0.0
and 1.0
.
run
- (verb) to perform the instructions written in code or an executable. Code is a set of instructions, and “running” code is when the computer actually performs those instructions. To “run” a function means to call that function (see call).
Example: I wrote a new feature, and ran the code to check that it works.
string
- (noun) a type of value that represents text. The word “string” derives from the phrase “string of characters.” E.g. The string
"cat"
is a string (a.k.a. sequence) of the characters‘c’
,‘a’
, and‘t’
.
Example: I represented my name as a string in the code.
syntax
- (noun) the grammatical rules of a programming language. Every programming language has different syntax. Syntax determines whether code is written correctly or incorrectly, and is enforced by the compiler or interpreter. Code will not compile or run unless the syntax is correct.
Example: I forgot to write the brackets, so the compiler gave me a syntax error.
type
- (noun) the kind or category of a value. Every value has a type.
- The value
5
is of the integer type. - The value
5.2
is of the float type. - The value
"cat"
is of the string type. - Simple types, like integers, are usually provided by the programming language. The programmer can define more complicated types using classes. The type of an object determines what methods and instance variables are attached to that object.
Example: I got a crash because the variable contained the wrong type of value – I thought it would be an integer, but it was actually a string.
value
- (noun) a piece of data that can be contained inside a variable. Every value has a type. Values represent information, in a way that code can work upon.
- Code can: send and receive values over the internet save values into files convert values into different values etc.
Example: My program asks a user for the year they were born, then uses that value to calculate their age.
variable
- (noun) a named container for a single value. Variables are not values themselves, they are merely containers for values. Putting a value into a variable is referred to as assignment. Variables are named after the fact that their value can vary – a different value can be assigned to a variable at any time.
Example: I assigned the string value "Tom"
to the name
variable.
write
- (verb) to send output data values to an external destination – usually to a file. Can refer to sending data over a network, such as the internet. The opposite of reading.
Example: The program writes all its data to a file before it quits, so it can read the data back again next time it is run.