Code Vocabulary

Tow Center
Tow Center
Published in
3 min readJan 26, 2012

object: basically a synonym for “thing”. When you see “object” it can stand in for almost any of the terms listed below.

variable: a named container for information. The name can be any word or combination of words, as long as they’re not already used (“reserved”) by the programming language.

data type: the category of stuff a particular variable “container” has or can have in it. The data type of a variable gives you a sense of its general characteristics, and rules for what can be done to it or with it.

Numerical

  • Number: In javascript, this is the generic data type for any numerical value. Often you will use this data type to cast (see below) data that’s been loaded from an external data source, such as XML or JSON.
  • integer (int): Exactly what it sounds like, when you declare a variable of type int, it can only hold a whole-number positive or negative value.
  • float: A non-integer number; in other words, one whose precision (decimal places) may be greater than zero.

String: A string is a sequence of alphanumeric characters (which can include spaces), indicated by surrounding the string with either single (‘) or double (“) quotes. While either type of quote can be used to indicate a particular string, the opening and closing quote type must match. E.g.:

var myNameDouble = "Susan"; //this is fine
var myNameSingle = 'Susan'; //this is fine, too
var myNameBroken = 'Susan"; //this will produce an error. See how this comment is blue?

Object: Object (with a capital “O”) is probably the most versatile data type, because it can hold an arbitrary number of properties, whose names and data types are determined by the developer. When creating data-driven applications or pages, very often the types of objects created while programming will closely reflect the structure of the data objects being used (for example, an object may contain all of the information associated with a single item in an RSS feed).

Array: An array is an ordered (or indexed) collection of other data types. Arrays may contain only a single type of data (all numbers) or a mix (some numbers, some strings, some objects). While arrays are a useful data structure, when developing data-driven applications, creating separate arrays to “hold” lists of data is often unnecessary, as the existing data structure often acts as a de facto array for most of the ordered information in the application.

Boolean: A Boolean data type may contain only one of two values — true or false (which are therefore reserved words in almost every language). The Boolean data type is most often used in conjunction with Boolean and compound operators, which are used to compare two values to determine their relationship. Different forms may be used in different circumstances. E.g.:

== // is equal to
!= // is not equal to
>= // greater than or equal to
<= // less than or equal to
&& or AND // both joined variables must share the same value
|| or OR // either of the joined variables may have the correct value
! or NOT // the negation of a particular statement/value

functions & arguments (to functions): functions are kind of like recipes. The arguments to the function are the specific ingredients to be used; the “operations” or steps within the function are the steps of the recipe. Often at the end of a function, it returns a finished product to wherever in the program it was called from.

events, event listeners, event handlers: an event in a program is just that — something that happens. Very often, these may be so-called “user events”, such as a click or mouseover event; they may also be “system” events, such as a data file being successfully loaded from another web location. Event listeners are special functions, predefined by the programming language, that are triggered when their particular event occurs. An event handler is no different than any other function, except that it is associated with a particular event listener, and so is executed only when that listener is activated.

--

--

Tow Center
Tow Center

Center for Digital Journalism at Columbia Graduate School of Journalism