What is OOP? What is OOP?


Finally, we have started studying Object-Oriented Programming (OOP). Nowadays, almost every modern (and even not-so-modern) programming language supports OOP to some extent.

But what is OOP?

OOP is a programming paradigm in which we work with objects. We use objects of classes, class methods, and their properties to build applications.

Programming paradigms

A programming paradigm is, in simple terms, an approach to programming. There are several different programming paradigms. Let's consider the most basic ones:

  1. Procedural - This programming paradigm involves organizing code into procedures or functions to promote modularity and reusability. It encourages the use of functions or methods to encapsulate functionality, making the code more structured and easier to maintain. Languages like Python, Pascal, and C support procedural programming alongside other paradigms.
  2. Functional - Functional programming is a paradigm that emphasizes treating computation as the evaluation of mathematical functions. It encourages immutability and the use of pure functions that don't have side effects. Functions are first-class citizens, and the code is often organized into smaller, reusable functions. It enhances readability, extensibility, and ease of writing. Languages like Haskell, Lisp, and JavaScript support functional programming.
  3. OOP - as mentioned earlier, this paradigm allows us to work with objects, class methods, and properties. Using them, we build the logic of the application/website/game. This type of code is the most extensible and readable. Sometimes, writing code in this paradigm can be more challenging than functional programming, but it pays off as it becomes much easier to work with such code in the future. Almost all popular programming languages now use OOP.

You might be wondering which specific objects of the class we are operating. Let's take a closer look at this with an example:

Image 1
Image 2
  • In the first photo, we can see what class properties, methods, constructors, and overridden methods are. You have learned all of this in the previous courses, so we won't dwell on it. It's worth noting that these properties are defined within the class itself and then utilized when creating instances in other classes;
  • In the second photo, you can see how we create class objects through a constructor in which we define the properties of this class. It is precisely these objects that we operate on in the OOP paradigm. These objects have their own properties and methods that we can invoke.

This may look quite simple, but, in fact, this is the essence of OOP programming. However, it is also essential to consider the principles of OOP programming. We will discuss one of them, "Inheritance", in the next chapter.

1. What programming paradigm is considered the most scalable?
2. What is the main difference between procedural and functional programming paradigms?


What programming paradigm is considered the most scalable?

Select the correct answer


What is the main difference between procedural and functional programming paradigms?

Select the correct answer

Everything was clear?

Section 2. Chapter 1