Post

Abstract talks

Abstraction is a very common term when we talk about programming. But what exactly does this mean? Painting?

To understand better, let’s explore the concept within the context of Object-Oriented Programming (OOP), which uses classes and objects.

Imagine you go to a restaurant. At the restaurant, there are a series of elements with which you interact to get your meal. These elements range from objects (such as tables and chairs) to actions performed by you or the restaurant staff.

In the OOP concept, a class is an abstraction that defines the properties and behaviors of a type of object. For example, the Restaurant class can abstract characteristics such as the type of food it serves, the rating level, the number of seats, among others. Additionally, the class can define behaviors such as preparing food, making a delivery, and receiving customers.

The main idea of abstraction is to simplify complex systems by focusing on the essential parts and hiding the more complicated and unnecessary details. This allows the developer to work with complex systems by creating simpler and more general representations of objects.

In the case of the restaurant, you don’t need to know the chef’s name, how the building was constructed, or where the ingredients were purchased. What you need to know is what the restaurant does: it receives people, prepares and serves food, and also makes deliveries. These are the class methods. And it has the structure for that, which are its attributes.

This approach helps manage complexity and allows for a clearer and more objective view of the system.

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.