Object Oriented Programming fundamentals – notes

Object != Class
A class provides the definition of the object type. It defines properties and actions.
An object is an instance of a class
The object variable is the variable that references the object result of the instantiation. It holds the state of the object. It retains the values of its properties.
Objects only exits at runtime.

A class – a cookie cutter
An object = a cookie made by the cookie cutter

Business object, entity

A business object is a class specifically defined for solving a business problem
An entity is anything from the real world that is significant enough to be represented as a class in the application

OOP
Object Oriented Programming is  an approach to build applications by focusing on objects that interact cleanly with one another in a way that is flexible, natural, well-crafted and testable.

In order to build to solve a real problem

Identify classes
Separate responsibilities
Establish relationships
Leverage reuse

The 4 pilons of OOP

Abstraction is a concept, a way to think: define appropriate classes by focusing on what is important for a purpose. Appropriate abstractions depends on the requirements of the application.

Cohesion
Collaboration – « uses a » – one class uses another class. Example, orderRepository uses the Order class to display the order or to serialise