Which programming language is completely object-oriented

procedural vs. object-oriented programming

Object-oriented programming (OOP) and procedural programming are two programming paradigms.

Object-oriented programming (OOP) and procedural programming are two programming paradigms. A programming paradigm is a basic style or approach to computer programming. These differ in how various elements of the program are conceptually presented and implemented, but also in terms of how the steps required to solve problems are defined.

As the name suggests, OOP concentrates on representing problems using quasi-real objects that have a certain behavior, while procedural programming maps problem solutions using procedures. Procedures are summarized instructions that run in a specific order. There are programming languages ​​that support key aspects of OOP (called OOP languages), procedural programming (procedural languages), or both of these concepts. Basically, OOP and procedural are two ways of presenting solutions to problems, it doesn't matter which language is used. In other words, OOP languages ​​can be used for procedural programming, while procedural languages ​​can - sometimes with some effort - be used for OOP.

What is procedural programming?

Procedural programming is a type of programming that seeks to solve a particular problem by determining the number of steps and the sequence of steps required to achieve the desired result or state. One of the main concepts in procedural programming is the procedure call. A procedure, also known as a subroutine, method, or function, contains an ordered list of instructions to be executed. A procedure can be called at any time during execution by another procedure or for itself. Examples of typical procedural programming languages ​​are C and Pascal.

Programs often consist of modules that are parts of a program that can be coded and tested separately and then put together into a complete program. In procedural languages ​​(such as C), these modules are procedures, where a procedure is a sequence of instructions. In C, for example, procedures are a series of imperative statements such as assignments, tests, loops, and calls to sub-procedures. These procedures are functions that take arguments and ultimately provide dependent return values.

An alternative to procedural programming is object-oriented programming. Object-oriented programming is intended to reduce the difficulties that can arise in procedural programming. In object-oriented programming, the main modules in a program are classes, not procedures. With the object-oriented approach, developers can create classes and objects that model real objects.

What is Object Oriented Programming?

Object-oriented programming is a programming paradigm that primarily relies on abstraction (in the form of classes and objects) to create real-world models. An object-oriented application uses a number of objects that communicate by passing messages to appropriate functions to accept them. Objects can forward messages, receive messages, and process data. The aim of object-oriented programming is to increase the flexibility and maintainability of programs. Since programs created with an OO language are modular, they can be developed more easily distributed and easier to understand after development.

In OOP, the focus is on dealing with the problem to be solved in terms of elements of the real world and depicting the problem in terms of these objects and their behavior. An object is a data structure that is very similar to a real object. Objects contain data fields and methods that represent the attributes and behavior of real objects. There are several important OOP concepts such as data abstraction, encapsulation, polymorphism, messaging, modularity, and inheritance. Some popular OOP languages ​​are Java and C # - apart from the fact that there must be at least one superordinate "frame class" ("main"), these can in principle also be used for procedural programming.

Real world objects all share two properties: they all have state and behavior. An object-oriented way of thinking consists in identifying the state and behavior of real objects. The complexity of objects can vary, some objects have more possible states and more complex behaviors than other objects. Software objects are conceptually similar to real objects. An object saves its state in data fields and defines behavior via its methods.

Classes and objects

A class defines the entirety of objects of a certain kind, with common properties, operations and behavior. In object-oriented languages, a class is a data type and objects are instances of that data type. In other words, classes are blueprints or prototypes from which concrete objects are created.

For example, we can design a "Human" class, which is a collection of all the people in the world. Humans have a condition that is determined by characteristics such as height, weight and hair color. They also share common behaviors such as walking, talking, eating. The entire state and behavior of a person is encapsulated (contained) within the human class. An object is an instance of a class. Objects are units of abstraction - at runtime, a program can theoretically generate new human objects at any point in time and in any number according to the blueprint of the human class. An object can communicate with other objects through messages; An object passes a message to another object, which leads to a method being called. Objects then take the actions necessary to get a response from the system.

Comparison and special features

The main difference between OOP and procedural programming is that the focus of procedural programming is to break the programming task down into a collection of variables and subroutines, while the focus of OOP is to break the programming task down into "natural" objects, the data and Encapsulate methods. The most noticeable difference could be that during procedural programming procedures are used to work directly with data structures, OOP links the data and methods together in such a way that an object with its merthodes works on its own data and changes its own state. When it comes to nomenclature, procedures, modules, procedure calls and variables from procedural programming in the OOP context are often referred to as methods, objects, messages and attributes.

When planning the design of an object-oriented program, a developer usually begins with a list of classes that must be included in the program. For a grading system, for example, there would be classes for users, classes, schools, etc., depending on which data has been saved in the system or is to be saved in the future and how the data relates to one another.

Once a developer has an idea of ​​which classes to use in the application, they will typically draw the system using diagrams such as the class diagram to illustrate the system. During this process, the developer can make changes to the system and check for errors in functionality. If the developer orients himself to a diagram that describes the required classes including the functions and methods, the connections become more present through the visualization and the identification and solving of conceptual problems is often easier.

The design method most commonly used in procedural programming is known as top-down design. Here you start the design based on a problem (procedure) and then break down the problem systematically into sub-problems (sub-procedures). This is known as functional decomposition, and it continues until a sub-problem is simple enough to be solved by the appropriate sub-procedure. The difficulty with this type of programming is that maintaining the software can be difficult and time consuming. When changes are made to the main procedure (above), those changes can propagate to the sub-procedures of main and sub-procedures, etc., and the change can affect all procedures in the pyramid.

Areas of application / conclusion

One advantage of object-oriented programming is that the code, once written, can be maintained and modified comparatively easily in the future, for example because new classes can be designed that inherit the properties and behavior of existing classes. This shortens the development time considerably and makes it easier to adapt the program to a changing environment or new requirements.

In contrast to object-oriented programming, in which objects and classes can be referenced throughout the program, the problems that are solved in procedural programming must be addressed individually during the execution of the program. When developing with procedural programming, a developer can also take a completely different approach to designing an application. Procedural programming requires a top-down approach to writing an application. While a developer using object-oriented programming to create applications plans the program with reusable classes, a developer using procedural programming can plan the program without this concept of "code recycling". Planning is also involved in procedural programming, but it requires a less abstract approach. In the case of a rating system, for example, instead of thinking about which classes or objects to use with functions and methods, this would mean focusing on which instructions should be processed in which order when the code is ultimately executed.