Which language is not a true object-oriented programming language? There are many programming languages which are not a true object-oriented programming languages like Fortan, Algol, Cobol, Basic, Pascal, C, Ada, and etc.
To decide which language is not a true object-oriented language, understanding the origins and paradigms of object-oriented programming is a must. Having an understanding of object-oriented programming terminology is also required to decide whether the programming language is a true object-oriented language or not.
What do you mean by Object?
Objects consist of a set of operations and a set of variables called data members. Set of operations is called member functions that act on data members. Object is defined as follows:
operations _or_methods (interface_of_message_patterns_to_which_the_object_respond)
Lets declare an object named circle having variables x, y and methods to read and change these variable can be declared as follows:
x = 0; y=0;
read – x ; return x
read – y; return y
change -in-circle x(dx) = x + dx;
change -in-circle y(dy) = y + dy;
The circle object restricts unauthorized access of its variables x & y. The behavior of an object depends on responses against messages and is not influenced by its data members. This is known as object-oriented message passing. An object consists of members functions that can be represented as:
Object having operations op_i have type T_i has following interface:
Interfaces of typed records are called signatures. The circle object signature is:
circle-interface = (read-x:Real, read-y: Real, change-x:Real → Real, change-y:Real → Real)
The operations read-x and read-y both return a parameter of type real. The operations change-x and change-y accept a real number and return a real number.
Operations that are defined in an object undergo a change in its state; this change in state is shared by other operations under execution. The current state of the operation is accessed by using instance variables of objects. For example, the operations read-x and change-x both have access to the instance variable x, x is a data member of an object, so it is accessible by both the operations read-x and change-x, but within the definition of operation read-x and change-x, variable x is different that is it is non-local.
Suppose a variable is accessed within a function that is not declared within its scope causes an error. This is possible with the help of objects. Thus member functions of an object can access data members of the same object. Member functions that are not within the scope of the object can not access data members. These data members are protected with the help of a mechanism called encapsulation. Encapsulation reduces the power of reusability. Encapsulation provides a distinction between objects belonging to two different systems.
The access of data members and member functions can be described as follows:
let x = 0; y = 0; in
read – x: return x;
read – y: return y;
change-x(dx): x = x + dx;
change-y(dy): y = y + dy;
What do you mean by Classes?
Classes are used to create objects. The class circle consists of data members and member functions. Instance variables of the circle class can be used to access the data of members of the circle class. The Instant variable of the circle class is instantiated when an object is created.
Class is created as follows:
operations or methods (shared_by_all_objects_of_the_class)
To access the data, members and member functions, objects of the class are created in the following manner:
p = make_instance_point;
Objects created can also be initialized using the following statement:
p1 = make_instance_circle(0,0);
p2 = make_insatnce_point(1,1);
The two objects p1 and p2 of the class circle have their copies of data members and member functions. When an object calls a function, then it executes that copy of the function that it has.
The class is used to define the desired functionality that the programmer requires. Then, to access these functionalities, objects are created. Finally, the class’s behavior is determined by its member functions to find the structure of the class objects used.
What do you mean by Inheritance?
To reuse the functionalities of the class, Inheritance is used. With the help of Inheritance data, members and member functions defined in one class can be used in another class. Thus it supports reusability. The class which reuses the functionalities is called the child class, and the class from which the functionalities are taken is called the parent class.
In object-oriented programming, inheritance plays a critical role. Inheritance plays as the base for classification, specialization, generalization, approximation, and evolution. Inheritance models real-world scenarios.
Another object-oriented programming system is the Common Lisp Object System [CLOS]. CLOS has another definition for classes, methods, and objects. For example, in CLOS class is defined as follows:
(defclass classname (superclass list) (list of instance variables))
Methods in CLOS is defined as follows:
(defmethod method (list of classes) (method definition))
CLOS supports multiple inheritances. Because multiple inheritance methods belong to different classes. In CLOS, all the member functions can be grouped into a single defgeneric definition:
(defgeneric methodname (list_of_method_definitions_with_given_methodname))
When a CLOS object executes a member function it calls a generic definition of that member function. This is in contrast with Smalltalk, which tries to find methods within the class definition.
Object-Oriented Programming has a paradigm. This paradigm deals with objects that contain data members and member functions. Procedural languages are not object-oriented.
In procedural languages, the execution of instruction sequentially takes place. Furthermore, procedural languages give execution steps; thus, it provides a systematic order of programming instructions to complete a specified task.
In a procedural language, procedures are defined beforehand. In procedures, programming instructions and variables are defined within the same programming blocks. A few of the procedural languages that are not object-oriented languages are:
Fortran is the first high-level language. Fortran was designed to write programs by engineers and scientists.
Algol is a programming language developed to resolve portability and introduced the concept of formal argument and actual argument.
COBOL is a commercial language. The COBOL program is divided into four parts, and each part has its objective. The four parts consist of – IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE.
BSIC is Beginners All-purpose Symbolic Instruction Code. In BASIC large programs may be developed, and required error messages may be evoked. BASIC can handle general-purpose language, and programs related to business and education can be easily developed in BASIC.
Pascal introduced the concept of structured programming. In Pascal, programs may be broken down into modules, procedures, and functions.
C is taken from ALGOL 60. C is a language that combines features of high-level structured language and low-level programming. C is used to write operating system programs, compilers, and other business applications.
Ada is a programming language that was developed to overcome the high cost incurred in developing the software. Ada divides large programs into modules, and each module can be compiled and tested independently.