Object Oriented Programming

Hello,  this is Bndsbon. In this very blog post, I am going to talk about Object Oriented ProgrammingDifferent than Java, OOP is more broadly defined, let us first compare OOP with Procedural programming.

Procedural programming:

Focuses on how to accomplish a target or how to finish a task.

large bulk part of the program is divided in the bits of small parts called unite procedural programming.

It mostly concentrates on functions

It is regarded as the oldest paradigms

Example: FORTRAN

OOP:

Emphaises on the events that occur on those objects

small parts of the program is called objects

Data and functions are combined together called class

comparatively difficult for beginner

Example: Java

Unknown.jpeg

picture from pinerest

First, let us look at the object in OOP, which is the most basic, fundamental, and crucial thing in OOP.

Every object in OOP has state and behavior. Objects also have their own identity, their own attributes, including color, weight, and signs. Last but not least,they have different behaviors as well.

A class, can be regarded as a blue print in OOP. Class itself allows us to separate data from each object, and in the mean time, allow us to manipulate the codes using common codes.

We use classes in OOP on a daily bases because they manipulate units like flights and ships.

Objects are the instances that we created in a class. And the actions that the object do or does is called Methods

Fields of classes includes instances variables and static variables. It can be any of the objects from the same class, or primitive data types.

oop[1].jpg

picture from study tips and tricks 

屏幕快照 2017-01-07 下午7.19.10.png

Here are the exercises I did in Chapter 1

屏幕快照 2017-01-07 下午7.24.39.png

For Mac touchpad users, all you need to activate the circle is to use two fingers and click it, chose the “void makeVisible().” you will see the picture below

屏幕快照 2017-01-07 下午7.25.14.png

After giving some simple commands, this is what happens to the circle

屏幕快照 2017-01-07 下午7.28.05.png

After we invoke the move horizontal method, this is what happens

屏幕快照 2017-01-07 下午7.29.16.png

with the help of the method call, we can move the cirle any units we want, in a very simple click.

屏幕快照 2017-01-07 下午7.33.43.png

Once we insert the value in, this is what the program gives

屏幕快照 2017-01-07 下午7.33.24.png

The “State” is like an examiner, it examines the state that the code is in.

屏幕快照 2017-01-07 下午7.35.10.png

Here is another example that is adding students to a lab class

屏幕快照 2017-01-07 下午7.38.38.png

All in all, in this class we are learning about OOP, and some fundamental key words. Though they are the very basics, if we do not pay special attention to them, we will be in “big trouble”. And after learning about them, I found myself more clear on programming, and everything is getting more organzied. However, even you know how to program an application with OOP, it is still important to type it down by your own, whenever the question asks you to do so. Because it is the only way to get familiar with all those complicated codes and programs.

Looking forward to our next class!

References:

Aringale, Shubhangi. “Features of object oriented programming (OOP).” Study Tips and Tricks. 7 Apr. 2014. Web. 16 Dec. 2016.
“Object oriented programming.” pinerest. Pinterest, n.d. Web. 16 Dec. 2016.

Leave a comment

Create a free website or blog at WordPress.com.

Up ↑