Abstraction is one of the most important concepts of object-oriented programming. From it comes from how objects are drawn in the form of classes, their characteristics are idealized as attributes and functionality as methods.

The concept is based on the following: from a real situation, the subjects involved, inanimate or not, are converted to the code in the form of objects. We can use the example of a lynx that needs to be registered in a zoo system.

We will work with the example mentioned above using the PHP language. First, then, let’s create the “Lynx” class.

class Linx{

}

Our object is now created. Below we will implement some attributes which are nothing more than the subject’s features.

class Linx{

private $name;

private $weight;

private $id_ident;

}

Attributes can also consider information as personal documents and unique identifiers. The variables in this case are declared as private so that treatment of them is done using another concept of object-oriented programming: encapsulation.

Created the object and its attributes, it is now necessary to create the features in the form of methods.

class Employee{

private $name;

private $weight;

private $id_ident;

function Register ()

{

//code here

}

function Delete()

{

//code here

}

}

With the created methods, it is now possible to register and delete any Lynx that arrives at the zoo. These would be the most basic methods. Thus, many others may be created in order to make the most complete object.

The real-world objects abstraction capacity for programming is essential for the development of activities of any programmer. Understanding the concept and applying it properly will save hours of development and ensure greater productivity to the environment.

Check out more content on our blog!
Learn all about Scriptcase.

By ,

May 7, 2015

a

You might also like…

How to Create and Read QR Codes and Barcodes

“Point your cell phone camera to read the QR code.” This phrase has been increasingly recurring...

Why is Low-Code essential for any business?

Low-Code is the IT term that refers to the process of using little code to develop software and app...

“The Preventus Medical Center system has more than 222,000 patients and 115 professionals.” (DRey Solutions)

Check out how DRey Solutions uses Scriptcase to streamline and synthesize the process of maintenanc...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.