Instructor: So now that we learned
about the Law of Demeter, we should dive
into a couple of other often cited principles,
which you should be aware of when working with classes
and especially when writing code in an object oriented way.
And here, amongst the most popular principles,
we would have the so-called SOLID principles.
We should write classes in a SOLID way,
and SOLID is an acronym which stands
for five different principles which you should apply
to your classes, so which you should respect
when writing code, to end up with clauses
which are considered to be well-written,
extensible and maintainable.
Now here's what these different characters stand for.
The S principle is the single responsibility principle,
and we're going to have a closer look at these principles
over the next minutes, of course.
O stands for open-closed principle,
L for Liskov substitution principle,
I for interface segregation principle,
and D for dependency inversion principle.
These are the SOLID principles
which you typically should follow
when writing object oriented code.
Now, it's especially the S and O principles
which also matter to us when writing clean code
because, as mentioned multiple times,
whilst all patterns and principles,
of course, tend to make our code cleaner,
we especially have two principles here
which have a very clear impact on the cleanness of our code.
So therefore, let's take a closer look
at the single responsibility and the open-closed principle,
but, of course, let's also briefly look
at the other principles over the next minutes.