#WSQ03 – Object-Oriented basics and a pie

I like pies, everyone likes pies.

Here’s a photo of some pies:


But this post is not about pies, it’s about A PIE.

A PIE is an easy way to remember the 4 more important concepts of OOP.

A: Abstraction.

Abstraction means that in object oriented programming we need to abstract real world objects intro a simple concept, considering only the more essential behaviours and attributes to define that object in a general way.

P: Polymorphism.

This term refers to the fact that in Object Oriented Programming we can have the same Interface for different Objects. For instance, the plus sign, when used with number, we add these two number, and when used with strings it concatenates these two strings.

I: Inheritance.

This means that a class can inherit methods, attributes and fields from another class, and with this you are able to describe a general concept, like mammal animals, they share common characteristics, and then you can create a human class, that inherits from the mammal class, so that it is able to produce milk, but then you can add more specific behaviours to that class, like talking and stuff.

E: Encapsulation.

The idea behind encapsulation is to be able to think about objects as a black box, in which you don’t care how it works, but you care about what it does. Imagine you are using objects and you decide to change the inner behaviour of the object, if there were not encapsulation you would have to do changes wherever you used that objects, but with the encapsulation you can change the behaviour, not affecting anything outside the class of these objects.



Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s