Classes, Objects, Entities the classic approach
This article explains the concepts of Class, Entity and Object using the classical approach.
The most basic concept in Java is the Object Oriented paradigm (OOP). The OOP paradigm was the natural evolution of the functional paradigm.
The OOP centers the attention on the concept of object, this concept is so strictly interlinked to the concept of class that it cannot be exlained if we first don't understand what is a class.
A class is the modellization of an entity in the domain of interest of a program
To explain this in english we need to say that the OOP covers the level of abstraction of modelling the entities. This is the main difference between object oriented languages and functional languages. In the functional paradigm the language understands just operations on data, (basically what to do on which piece of information).
The big evolution of object oriented paradigm consists in the possibility to group all the data that relates to a particular entity in a single structure, which includes also the commands and operations that are intended to manipulate the data.
In OOP these structures need to be formalized in actual source code.
OOP splits further these conceptual structures in two parts:
I will make these concept clear, with an example:
Say that we want to implement "myAddressBook", a program to manage an address book.
In our program for sure we will need to model the concept of contact. A contact is a person that we know, in the program we want to manage information about him/her. The information we will manage for each contact is the first name, the last name, the phone number and the address.
Once our program will be ready we will use it to store the real information about our friends, so we will use the model of contact to populate the first and last name, the phone number and the address.
In this example the contact to our friend is the entity that we want to model. The model of the entity is what whe call class which formalizes the information that we want to manage about the entity. When we use the program to remember information about our friends (read: manage the information about our entities) we are in facts instanciating the class and creating objects with the actual information about the entities.
An entity enters in the program only through objects, they can't be explicitly used in programming (you don't want to put a friend in the address book, his name and phone number should suffice, huh?).
The classes are what we can write in the source code of our program, they represent a model for the entity made in such a way that they can represent many different entities of the same kind.
The objects are instances of a class, and they contain the information about specific entities.
At this point these two statements should One class may be instanciated into many objects. Normally classes do not change between the executions while objects do.
These three concepts are the basic of the object oriented paradigm. They are very powerful.
If this article was not clear read new approach to explaining objects which will be for sure easier.,