Objects and State

Learn the difference between state and objects.

We'll cover the following

People think that Object-oriented programming (OOP) is something very complicated, magical, and difficult to understand. But in reality, it’s mostly straightforward. The right way of doing OOP could simplify the daily life of a programmer. However, it requires more brainpower than the common way of doing OOP.

This course covers the essentials, including the common way of doing OOP, which is a must for every beginner. If you’re looking for an elegant way of writing your object-oriented code, start reading Elegant Objects by Egor Bugayenko.

Class

Object-oriented programming assumes there should be an object somewhere. But what are objects? From our everyday lives, we know that everything is an object, like a book on the table, for example, or a man walking down the street, or BMW model E34 crossing the road. But if we look closer, BMW E34 is a certain class of objects. This particular BMW is the same as another of the same model. But at the same time, they’re different instances.

The most obvious example of a class is a technical drawing of a jewel:

Get hands-on with 1200+ tech skills courses.