In this video you will learn about the purpose and use of programming concepts such as identifiers, containers, functions, and objects.
An identifier is the user-defined name of a program element. It can be a namespace, class, method, variable or interface.
Variables
A variable is a named unit of data that may be assigned a value. If the value is modified, the name does not change. For example, if X=3 and Y=4, you can use the expression X x Y to calculate the result (in base 10) of 12.
Constants
In computer programming, a constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant. Sometimes, constants are also called literals. Constant types include the following:
In programming, a container is a class, a data structure, or an abstract data type whose instances are collections of other objects. In other words, they store objects in an organized way that follows specific access rules. Typically, the objects in a container include an array or vector to store data as well as objects for viewing, loading, and unloading data from the storage object. Containers are known as collections in some languages, such as Java.
Arrays
An array is a data structure that contains a group of elements. Typically these elements are all of the same data types, such as an integer or string. Arrays also have a fixed maximum size. If an array needs to grow to hold more data, the programmer must allocate a new array that is large enough to hold the additional data and copy the old array’s contents to it. For this reason, an array should be used only if the programmer knows in advance the maximum number of objects it needs to hold.
Vectors
A vector is a resizable collection of the same type of object. Unlike an array, a vector can be resized as needed and new objects can be inserted anywhere into the collection as needed.
A function is a type of procedure or routine. Some programming languages make a distinction between a function (which returns a value) and a procedure (which performs some operation but does not return a value). Most programming languages come with a prewritten set of functions that are kept in a library. You can also write your own functions to perform specialized tasks. To use a particular set of functions, the programmer must call (request) the function library in the program.
A user-defined function is defined at the top of a program. This enables the function to be referred to repeatedly in a program and the compiler to compile the code before it is used. For example, a function called drawshape is defined from the lines of code needed to draw a shape. However, after it is defined, the programmer can simply refer to the function drawshape and the program will locate the function and repeat it.
A function library is a collection of procedures that can be used (called) by other programs. By using a function library, a programmer can reduce development time by not needing to develop new code to perform a particular task. Some function libraries are included in a language, but others can be licensed from third-party developers.
An object, in object-oriented programming (OOP), is an abstract data type created by a developer. In most programming languages, objects are defined as classes. An object is a combination of data, its properties, its attributes, and procedures that can be used with that data, also known as methods. Object-oriented programming builds programs from objects.
Properties
A property, in some object-oriented programming languages, is a special sort of class member, intermediate in functionality between a field (or data member) and a method. Some languages define an object’s properties as the values associated with an object. For example, in JavaScript, in the variable (var) person, the first name, last name, age, and eye color can be defined as properties.
Attributes
An attribute is a specification that defines a property of an object, element, or file. For example, a shoe object could have these attributes: color, size, manufacturer, etc.
Methods
A method in object-oriented programming (OOP) is a procedure associated with a message and an object. Methods define what an object can do. For example, in a basketball game, a basketball game object could have methods such as shoot ball, dribble ball, pass, block, etc.