What we want to create now is something that will store all the posts in our blog. But to be able to do that we need to talk a little bit about things called objects.
Objects
There is a concept in programming called object-oriented programming. The idea is that instead of writing everything as a boring sequence of programming instructions, we can model things and define how they interact with each other.
So what is an object? It is a collection of properties and actions. It sounds weird, but we will give you an example.
If we want to model a cat, we will create an object Cat that has some properties such as color, age, mood (like good, bad, or sleepy ;)), and owner (which could be assigned a Person object – or maybe, in case of a stray cat, this property could be empty).
Then the Cat has some actions: purr, scratch, or feed (in which case, we will give the cat some CatFood, which could be a separate object with properties, like taste).
Cat--------coloragemoodownerpurr()scratch()feed(cat_food)
CatFood--------taste
So basically the idea is to describe real things in code with properties (called object properties) and actions (called methods).