Programming Paradigms – handling data within programs

A programming paradigm is a standard set of structure and conventions within programming languages that enable software developers to build efficient code for software applications. You could say that high level common programming paradigms could be defined as something like object oriented or event driven but there is scope to say that a paradigm is a model that defines a style of coding so it can be broken down beyond this. One requirement within programming languages is to be able to handle data effectively within a program. Therefore, most programming languages define a set of rules for how data is handled using common structures and conventions.

When handling data within a program, programming languages have a clear set of rules for how variables are defined and managed and although each language will handle this slightly differently there will be comparisons with the overall process for selecting, applying and interpreting data. This is done by using common data-handling techniques and structures. Let’s look at two ways in which this is done.

Defining and declaring constants and variables: Standards exist across all programming languages for the types of variables and constants that can be used in computer programs. Here are some examples:

  • Alphanumeric strings: A string value that can contain numbers and/or letters that is more than a single character long.
  • Characters: A single character value that can contain any number, letter or symbol contained by one byte.
  • Boolean: A True or False value used to determine the state of something. A 0 or 1 can also be used to represent false or true respectively.
  • Date/Time: Used to store dates and times in specifically required formats e.g. dd/mm/yyyy or hh:mm:ss or any other variance of date or time.
  • Objects: Used to define the characteristics or classify exactly what is included in object n object oriented programming. An example of an object in games development would be a character and the characteristics of this could be defined, reused and modified as needed to make multiple variances of a specific object.
  • Records: Is a list of values with fixed field names, records could be used within a programming language when transferring values to a database.

Managing variables: When managing variables it is good practice to have a specific set of rules for variable and constant naming convention. This is is to make sure that developers will understand the format of a variable and how it is passed through the program as they will be aware of it’s characteristics based on the variable name. Local variables and global variables are used as standard formats when handling data within a program as part of this paradigm. Local variables are declared within specific functions and the memory allocation of the variable is dumped after the function has finished executing so they require less program memory. The purpose of this is to speed things up and use less memory. Global variables are used within the main program structure and can be used to pass data throughout the programme and key variables can be allocated values from within specific functions if needed. This is quite common across a number of programming languages and allows for efficient memory allocation.

To conclude you can see that although paradigms can be defined as a set of rules that outlines a specific type of programming language they can also extend further into the rules of what can be done within a number of different types of programming languages. In this instance, the common types of data used and how this data is managed when looking at at handling data within a program. Although the way this is done across a number of programming languages and the syntax used will be slightly different the types of data and how they are managed will be quite common. You will see as a developer that understanding how data is handled is important and you could adapt when asked to program in other languages after you have a high level understanding of the rules and conventions.