Getting Started with Programming Concepts.

Getting Started with Programming Concepts.

A computer is only functional to the extent to which you instruct it. This means that without instructions (programs) your computer is so dumb and cannot produce results. This article will walk you through some of the basic programming concepts.

Programming is the process of instructing the computer on what and how to perform instructions.

Computers understand computer language, human beings understand and use human language. Therefore for human beings to communicate and instruct these computers, a balance was found - programming languages.

Programming languages are the source code; which has the possibility of being translated by translators into the computer’s exact language - the binary (1s and 0s) also known as the object code.

To take a look at these translators.

These include :

Interpreters -They process or interpret the source code, line by line. The source code when interpreted is executed or run directly from the source file.

Compilers - They interpret the source code at once and execute the file wholly. The compiled source code is first converted to a binary file which is now executed.

Data Structures

Data structures ensure proper organization and management of data in an easier to understand way. It denotes a specific method of storing and organizing data in the computer for operations to be performed on such data in a more efficient way.

Arrays - They are the building block of other data types. An array is a structure of fixed size that contains elements of the same data type. There can be an array of numbers or an array of strings that are indexed. It is normally used for sorting algorithms.

Stacks : This is a last-in-first-out type of structure. This entails that the item stored last will be the first to be accessed.

Think of this as if in the process of washing dishes and serving food. You wash the dishes, rinse them and then stack them on top of each other. When it is time to dish food, coming to the same stack of plates, the same way you would take first the topmost plate which was the last one you placed on the stack is the same way the stack data structure accesses first, the last data stored.

It is used to implement function calls in recursion programming.

Queue: This is a first-in-first-out structure. The first data to be stored is the first to be accessed. It works the same way as the queue structure in a real-life scenario.

It is used to manage threads in multithreading.

Linked list : it is a sequential structure containing a sequence of items arranged in a linear order and linked to each other. Data are accessed sequentially. Each element in a linked list is called a node.

It is used in switching between programs using Alt + Tab.

Hash tables: This is an array that links a key to a particular data value. The hash function generates an integer of fixed size for a key that will be associated with the key. In the hash table, data are stored in a key-value pair. Just like the dictionary way of representing data, where the name of the word is the key and the entry is the value.

This is used to implement the ‘set’ data structure.

Trees: This is a hierarchical data structure. Data are linked together hierarchically. Binary search trees store values in sorted order.

It is used in search applications where data are constantly entering and leaving.

Data types

Variables provide a location where data are stored based on the name of the data type stored in the variable. Variable names should reflect the values stored in them. Example

schoolFees = $50

The variable ‘schoolFees’ is used to store the amount paid as school fees. Some variables are used to store texts, some are used to store numbers and some are used to store other types of data.

Data types are formats in which the variables hold data.

Some of these data types are:

Strings/Texts : This is a combination of characters, such as numbers, and symbols.

Integers: This can be a positive or negative whole number.

Float: They are the decimal numbers or fractions.

Booleans: They are used where data is restricted to true or false, yes or no.

Control flows

This denotes the order in which programs or individual statements are executed within the function. It is the way the computer executes statements in a script.

Sequential: This is the default mode of code execution. Where the code is executed one after the other, in the sequence such code is written.

Conditionals and branching: It is a set of rules that can interrupt normal code execution, depending on whether the condition is completed or not. These rules are determined by conditions to execute.

Iterations /loops: It is a sequence of instructions that is continuously repeated until a condition is met. Such instructions keep running as long as the condition is true but ceases to run once it is no longer true.

In conclusion, programming languages are the nearest human way of communicating with the computer. These languages still undergo translations for computers to exactly understand them. The instructions are stored and organized in different ways to be accessed by the computer efficiently. Lastly, the computer executes these programs in different orders so that the desired result will be achieved.