Handling of Data Objects
This portion of the project will compare the handling of data objects in Simple Procedural programming languages to the handling of data objects in Object-Based, Logic, and Block Structured, Procedural programming languages. Since we are comparing several language groups to Simple Procedural languages, it makes sense to start with a discussion of this category of programming languages.
Simple Procedural Data Objects
Simple Procedural (SP) languages are typically very limited in their support of data objects. This lack of support stems from the fact that most SP languages are either very primitive or serve as a teaching languages. They not offer a large set of intrinsic data objects. These languages are typically not strongly typed, and do not require data objects to be declared before use. A special character ($ - for string data, for instance) is usually attached to a variable name to indicate range of values. For example, Name$ would indicate a string variable.
SP languages typically do not support any kind of user-defined types. This leaves the programmer with integers (long and short), real (regular and expanded) and string data types. This makes these types of languages very easy to learn.
VS Block Structured, Procedural
Languages:
Simple Procedural languages and Block Structured, Procedural languages start with similar support for data objects. Both categories of languages provide support for intrinsic data types of integer and real. Fortran, a block structured language, allows declaration modifiers (KIND) which can greatly expand the range of data objects. In fact, most block structured languages start with the simple procedural data types and then greatly enhance them.
Block structured languages also provide intrinsic support for several addional intrinsic data types, such as boolean and char data types. Fortran, a numerical based block structured language goes as far as to offer a complex data type that is used to represent complex mathematical expressions. Such advanced data objects would never be available in a standard SP language.
In addition to enhancing simple procedural’s intrinsic data types, block structured languages typically offer many more data objects. Languages in this category support pointers, record structures, enumeration types and set types. Both categories, however, support arrays.
Other significant differences exist between these two categories of languages. Simple Procedural languages use data objects that are of global scope. Block structured languages, as their name suggests, forms scope blocks or procedures. Data objects declared within these blocks only have scope within the block in which they were declared. When the program block goes out of scope, the data object looses meaning. This block structuring allows for a crude method of encapsulation.
VS Object-Based Languages:
Data objects in object based languages put SP languages to shame. This section will primarily discuss only the differences between these two types of languages. As one might expect, object based languages are rooted in the representation of data; this is the exact opposite of SP languages that provide only enough support for data objects to accomplish very simple tasks.
One of the few similarities between the two languages is that both categories of languages support integer and real data types. Support for these data types in object-based languages is generally greatly enhanced over that of SP languages. Object based languages usually provide a much greater range and precision of supported data objects.
Object based languages provide a whole mechanism for dealing with user created data objects. The language itself provides for protecting data and encapsulating both functions and operators relevant to the data object. This encapsulation allows programmers to define and control every aspect of how the environment interacts with their objects. A programmer can create custom functions that have a limited, set interface and allow only certain actions on the data. None of these kinds of features are available in SP languages.
The real power of Object-Based languages goes far beyond the creation of user defined data objects, or classes. (Which by itself, is incredibly powerful.) A language-supported technique of inheritance allows programmers to reuse parts of existing objects, or classes. This newly created class “inherits” all the characteristics of the original object, in addition to newly created data fields, functions and operations. This allows for great flexibility in software reuse, which can significantly reduce program creation time. Inheritance can also increase program reliability by the use of time-tested data objects. Nothing remotely similar to inheritance is included in the bare-bones Simple Procedural languages.
VS Logic-Based Languages:
Simple Procedural data objects share some basic characteristics with Logic based languages. Both categories provide very limited data representation, usually offering only integer and real data types. Neither language type supports any real kind of record structure, although most implementations of SP languages support arrays. Both language types also ignore objects such as pointers and enumeration types in their standard implementations.
The similarities end there, however. Logic based languages are fundamentally rooted in a boolean data type that is typically not supported by SP languages. This True/False data type is the very foundation of languages that comprise the logic category. The Boolean expressions form rules, which are evaluated to true or false. These rules are then used in a potentially complex form of predicate calculus to eventually prove or fail to prove a desired hypothesis. Although logic-based languages support integer and real values, they are used only as intermediate values, if at all.
This lack of use for variable objects directly contradicts SP languages whose sole purpose is usually the assignment and manipulation of variables.