Vision Java

Vision Java

Hello Readers! How are you? This is one of the blogs in the “September – Java month” series. Today I am going to talk about some basic Java topics and give you a different perspective to look at them. I guarantee you, if you get what I am going to tell you in this post things will start making sense to you and you could actually talk Java.

We will be talking about OOP concepts in this blog post so if you are not aware of it then I do suggest you to read this first.

According to me Java is not just a programming language, its an art. When you go deep enough in this you can actually relate Java to each and everything of your life. For example, for others it is a BAJAJ fan, but for you if is an object of class Fan which has different behavior(methods as we call in Java) like throwing air to you n like.

Vision on some Object Oriented topics:

  • Objects and Classes: As you might know what Objects and Classes are in Java. But let’s think about them in a different way for sometime.
    • Think of Neem trees. These trees have properties like height, age etc.
    • Now, suppose a Neem tree. This Neem tree has specific properties as height = 20ft, age = 10years. And think of a different Neem tree with different properties as height = 30ft and age = 15years.
    • So in Java sense Neem trees is a class here and the two different trees we talked about are the objects of this NeemTree class and both of them have different properties.
  • Constructors: Constructors are the methods used to initialize the properties of an Object. To set a particular property to all of the objects we use default constructor and to set custom properties at runtime we use parameterized constructor.
    • Think of it like the Neem trees have all their properties as same that is same height, same age of each and every Neem tree. This behavior is same when we create multiple objects of same class using default constructor.
    • This is feasible but unrealistic. To solve this we use parameterized constructors and this gives us flexibility to declare different properties to each and every Neem tree object at runtime.
  • Inheritance: Surectangleppose you are looking at your neighbor Qureshi Uncles’s house and his son Farhan has a different room. What you will see may vary as per your interest in them but if you think Java this is what you should see.
    • Farhan’s room is inside their home so the room is the superclass of the home class that is whatever is in the room, it automatically is in their home.
    • Properties of the room(color, size, number of windows etc) may or may not be same as the properties of their home. In the sense of Java, the subclass may or may not have different properties/behavior to the superclass.
    • If Farhan Qureshi has a camera and he doesn’t like it outside his room then this is his private property. This is the same as access specifiers in Java. Even if Farhan’s room is in the home, Qureshi uncle can not access it.
  • Data Abstraction: In real world data abstraction is when you play a game like Subway Surfer but you need not to know how the game is running on your mobile phone. What resources it is using? How has the game built? All these are unnecessary informations that you need not to know at all if you want to play that game.
  • Data Encapsulation: We can relate Data Encapsulation to real world using Cars. Think of a car having properties like Top speed, acceleration, torque etc and behaviors like accelerate, brake etc. All these properties and behaviors are inside a single unit that is car. This is the way Data encapsulation concepts works in Java allowing all the properties and methods to be encapsulated as a single entity called Object.
  • In a similar way you can visualize Polymorphism, method overloading, method overriding also but I want you to think about them so that you can develop your own thinking methodology and develop sense in programming. If you master this art then it is a piece of cake for you to solve many practical real life problems when you start making your first project in any programming language.
  • If you are getting what I am saying then you are even closer to the awesomeness of programming. And believe me in programming, Sky is the limit.



Well Readers! I hope my blogs are beneficial for you all. I am eagerly waiting for requests and suggestion for topics on which I should write. Do send me your suggestions and requests. Even if I have missed out on something in this post, do comment about that below.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s