Object-oriented programming (OOP) is a programming paradigm based on the modularization of programs and is very different from classical procedural programming. Object-oriented software, if well designed, is easier to maintain and extend than procedural. In addition it simplifies unit tests and reuse of software parts by the strict modularization. It follows the programming paradigm of imperative programming.
In object-oriented programming, programs are divided into units called objects. Each object has a state, which is described by its characteristics (object attributes). Only the functions (calledmethods ) present in the object itself can manipulate its data and thus change its state. Objects can send messages to other objects (by calling their methods), requesting them to change their state. Ultimately, however, it is up to the object itself whether it complies with the request. Thus the object is always in a well-defined, self-controlled state.
In OOP programming, data and functions are combined into objects. These objects can be related to each other in many ways, by calling each other's methods or by one object containing other objects. Thus the objects of a software form a very flexible total system.
The class assignment of objects
Each object belongs to a class. Classes are also often described as blueprints for objects, because they define which attributes and methods the associated objects have. Each object is an instance of its class, one says also: The object "o" instantiates the class "k". There can be any number of objects of a class, whose properties can differ but do not have to. An enterprise resource planning system, for example, knows only one class article, but many article objects
Object-oriented programs fulfill several important criteria, which can simplify the development, accelerate and at the same time improve the quality:
- Data encapsulation: the data of an object cannot be changed uncontrollably from the outside; ultimately, the object itself always decides on changes to its state.
- Interchangeability: Objects are abstractions of real entities and actors that hide their actual implementation from the outside world and thus become interchangeable.
- Inheritance: Properties and functions of an object can be passed on to other objects and adopted, modified or overwritten by them.
- Polymorphie supports the exchangeability of objects, because the same message can be sent to different objects and cause accordingly different actions with these.
Programming languages for object-oriented programming
Not every programming language supports object-oriented programming. C++ndPascal, for example, are purely procedural. Other languages, such as C++ or Object Pascal, allow OOP but do not enforce it. The resulting programs can be a mixture of paradigms. The same is true for languages such as Hypertext Preprocessor( PHP) or Perl, which can be made OOP-enabled by extensions. Others such as Eiffel, Smalltalk, Java or C# are purely object-oriented.
In addition to actual object-oriented programming, object-oriented methods for object-oriented analysis( OOA) and object-oriented design( OOD) of software systems have also become established. The Unified Modeling Language( UML) has established itself as the generally accepted notation for these procedures. Corresponding software tools, some of which are implemented in integrated development environments ( IDE), allow software to be generated from graphically designed systems or, conversely, document finished systems in UML notation.
A recurring problem in practice with many solution approaches is the connection of relational databases( RDBMS) and object-oriented software. Object Relational Mapping( ORM) performs a conversion of relational structures into objects and vice versa. Alternatively, object-relational or object-oriented databases can be used, but their distribution is not very large.