Object Oriented Programming

Introduction

In this sec­tion we are going to talk about the object-ori­ent­ed pro­gram­ming par­a­digm (POO in Span­ish, OOP in English). 

This is a very use­ful tool that will help us build intu­itive solu­tions for our pro­grams or video games.

What is object-oriented programming?

It is an intu­itive way of think­ing about the prob­lems we have to solve. 

When using POO, we think about which objects we should build so that they receive input infor­ma­tion, process it and pro­duce out­put information. 

Objects are abstract enti­ties that we will cre­ate tak­ing into account the way they must work, what are their basic char­ac­ter­is­tics, what are their respon­si­bil­i­ties, with whom they must relate, among oth­er factors.

Articles on object-oriented programming

Before we go any fur­ther I will leave a list of all the arti­cles I am cre­at­ing on this topic.

The­o­ret­i­cal arti­cle about class­es in scheduling.

In this arti­cle I explain what a class is in pro­gram­ming and give some exam­ples of class­es in C# lan­guage at Unity.

Prac­ti­cal arti­cle about class­es in programming.

In this arti­cle I pro­pose a prac­ti­cal exer­cise on pro­gram­ming class­es. We make class dia­grams and imple­ment them in Uni­ty in C# language.

Features of Object-Oriented Programming 

I will try to explain with my words what some of the great con­cepts that appear when study­ing OOP mean.

Abstraction

Abstrac­tion is a process of our intel­lect that allows us to take an object of study, relieve the fun­da­men­tal char­ac­ter­is­tics or traits and cre­ate a men­tal idea of that object.

From this men­tal idea we will cre­ate our pro­gram­ming objects.

Encapsulation

This fea­ture implies that all the data and func­tions of the object we want to mod­el will be gath­ered or encap­su­lat­ed in the same entity.

In prac­tice we are going to encap­su­late the data and func­tions that an object will have with­in a pro­gram­ming class.

Inheritance

Inher­i­tance enables you to estab­lish a class struc­ture orga­nized in hierarchies. 

In upper class­es (known as super class­es), prop­er­ties and gen­er­al behav­ior are defined and daugh­ter class­es (sub­class­es) are cre­at­ed that inher­it the prop­er­ties and behav­ior of the super class.

Through inher­i­tance, more and more spe­cif­ic class­es can be built, but they have char­ac­ter­is­tics in com­mon among them since they descend from the same super class.

Polymorphism

Poly­mor­phism allows us to take a set of objects of a dif­fer­ent type and exe­cute one or more meth­ods that they all under­stand, but the func­tion that this method exe­cutes will be spe­cif­ic to each type of object.

This allows us to cre­ate dif­fer­ent types of objects that respond dif­fer­ent­ly to the same stimulus.

This in my opin­ion is one of the most pow­er­ful con­cepts of the OOP. 

Principle of information hiding

This prop­er­ty has to do with the data and func­tions that are con­sid­ered inter­nal to an object. These prop­er­ties must be hid­den from the out­side to pre­vent oth­er objects from manip­u­lat­ing them directly. 

The objects will offer to the out­side a series of pub­lic func­tions to make use of their func­tion­al­i­ty and access or mod­i­fy their inter­nal data.

YouTube
Scroll to Top
Secured By miniOrange