# Object Oriented Programming Simplified

Posted on Posted in Object Oriented Programming

# Object Oriented Programming Made Easy

Alright, I’ve read so many object oriented tutorials that way over complicate concepts of oop. I’m going to break down each aspect of object-oriented programming, and explain each part in extremely simple terminology.  This post will focus on an object.

An Object Has Two Parts:

• Data
• Functions

For now, let’s say

data: Is a number

function: Is a way to change a number

In traditional math, we run functions on data all of the time.

Example:  f(x) = x + 1

• x = data
• function = x + 1

Function Input: data

Function Output: data + 1

In software development, objects have data and functions to manipulate that data.

So, let’s create: ObjectA

ObjectA{

x = 4

y = 2

function addFourToX() = x + 4

function doubleY() = y * 2

function getX() = return x

function getY() = return y

}

ObjectA has

• 2 data variables. x and y
• 4 functions. addFour, doubleY, getX, getY
• 2 of the 4 functions change data value. addFourToX , doubleY
• Last 2 of the 4 functions return the variable to use objects data with data OUTSIDE the scope of the object

print ObjectA.getX()

OUTPUT: 4

print ObjectA.getX() + ObjectA.getX()

OUTPUT: 8

print ObjectA.getY()

OUTPUT: 2

print ObjectA.doubleY()

OUTPUT: None, value not returned. This function only doubles the Y data value, but it Does not return the value

print ObjectA.getY()

OUTPUT: 4

An object is a way to define data and the functions to interact with that data in a single place.

Object Definition

Object-oriented programming (OOP) refers to a type of computer programming (software design) in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure.

In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.