Object-Oriented programming in a nut-shell.

The term 'Object-oriented programming'- oop comes off as a rather complex word when looked at a whole. It is a very common term that most developers may have heard, but probably not well well versed with. This is because the concept of OOP relies heavily on the concepts of abstraction and how they can heavily relate to the real world. Ideally, it is abstraction that brings the whole concept of OOP into being.

In today's blog post, I shall only discuss about the basic terminologies of OOP as well as a low-level implementation of the same.

Breaking down OOP, we have software objects which are often used to model the real-world objects that you find in everyday life. Therefore in this case, an example of an object would be a chair. It can be physical or logical (tangible and intangible). In more technical terms, an object is an instance of a class. This means an object a single and unique unit of a class.

A class refers to a blueprint or a prototype from which objects are created. A typical class is defined as having various methods (or attributes), has a particular data type e.t.c.

That said, a simple implementation of a class declaration in Java is below:
public class rhapsody{ //rhapsody here is the class name String chair; //String here is the data type
method;
}

Now here is a basic implementation of a class and object:

public class Rhapsody{ public Rhapsody(String name){
// This constructor has one parameter, name. System.out.println("Passed Name is :" + name );
} public static void main(String []args){
// Following statement would create an object myRhapsody
Rhapsody myRhapsody = new Rhapsody( "predator" );
} }

Compiling the above programme gives the following result: Passed Name is :predator

In my next blog post,I shall discuss more concepts on OOP, with a bigger emphasis on inheritance, encapsulation and polymorphism

On a lighter note:

Object-oriented programming offers a sustainable way to write spaghetti code. Adios!