Computer programming concepts
There are various computer programming concepts that are essential knowledge to anyone who wants to become skilled in the subject. While some are not universal, these concepts are present in the majority of computer programming languages and/or are a fundamental part of the programming process. This lesson focuses on these concepts.
-
Source code
A set of special instructions that can be written in a variety of computer programming languages that dictate what a computer program should do. Source code is the actual text used to write the instructions for a computer program. This text is then translated into something the computer can understand.
-
Compiler
A software tool that translates source code into data that the computer can understand. Specifically, a compiler is used to turn source code into object code. The object code is then passed through a program called a linker which turns the object code into an executable program.
-
Data type
The specific classification of pieces of information. The amount of different data types varies between languages. Typically, there are data types for integers (whole numbers), floating-point numbers (numbers with a decimal part), and single characters. To distinguish between different data types, a computer uses special internal codes.
-
Variable
A container which stores information in a computer's memory. Every variable has a unique name assigned to it that should give an idea about the data that it stores, and the type of data that a variable stores is specified with a data type that is typically used to store numeric values, characters, character strings, memory addresses, or even objects when working with an object-oriented language. For example, consider a variable used to store the first letter of someones name. Such a variable should be declared as a single character variable and could be named firstLetter. The value of a variable can change all throughout a program.
-
Constant
The same thing as a variable with one major difference - the value of a constant does not change, while the value of a variable can change all throughout a program.
-
Conditional
A segment of code that will execute or not based on certain things. Conditionals are used to test various expressions and perform certain operations accordingly. For example, if you were to test if a number input by the user is greater than 10, and if it is, you could print the message "The number entered is to high".
-
Array
A special type of variable used in many programming languages such as PHP, Javascript, and Java that contains a list of related values. For example, a colors array would contain a list of colors.
-
Loop
A segment of code that executes repeadetly based on a certain condition. Loops are used to perform certain tasks repeatedly a certain amount of times. For example, if you needed to print the numbers 1 to 10. You can use a loop for this task instead of manually printing all the numbers.
-
Function
A segment of code used to carry out a specific task or tasks. A function can take parameters which will effect its output as well as return values. Functions prevent unneccesary redundancy by having their code reused instead of the code being retyped. For example, if you need to multiply two numbers, instead of doing the calculation manually, you can supply the data to a function through some parameters which will do it for you.
-
Class
In object-oriented programming, a class is a template for a real world object to be used in a program. For example, a programmer can create a car class which emulates a car. This class can contain the properties of a car (color, model, year, etc.) and methods that specify what the car does (drive, reverse, stop, etc.).
-
Algorithm
A specific set of steps for carrying out certain tasks. Algorithms are used extensively in computer programming to arrive at a solution for a specific problem. The process of creating an algorithm involves documenting all the necessary steps needed to arrive at a solution and how to go about each step. A real world example of an algorithm would be a recipe. The collective instructions of a typical recipe (add ingredients, mix, stir, etc.) constitute an algorithm.




