Introduction to Object Orientation

Objects are everything and everything are objects - Kristian

In Java, everything is an object. But what does this mean?

An Object oriented langauage basically means that the language treats classes and numbers as objects, that have state and behaviour.

Let’s use a real life example, you. You have state (age, height, name, etc) and behaviour (eat, sleep, work, etc). Using this logic, it is easy to get to grips with understanding object-oriented programming. You just program your classes as if it was an object, by adding appropriate state and behaviour that the object that you are trying to emulate in a software form would have in the real world.

Take a minute to imagine this concept in more detail. Think of an object around you, say your air conditioner (assuming you have one). It has many possible states (temperature, strength) and many behaviours (changeTemperature, off, on, sense, etc). The behaviour of the object manipulates the state, like changeTemperature behaviour adjusts the temperature state, by increasing or decreasing it.

Using this termonilogy, you can understand the concept behind object-oriented programming, and understand that it brings structure, convinence, and coherance to your program. Next we will explore Object Orientation a bit more and show you how an object on Java would look like.

Next »