This will be a serie of articles about Design Patterns. To describe the patterns, we must have some basic knowledge of UML.
UML uses ‘+’, ‘-‘ and ‘#’ to mark accessibility.

- + denotes public attributes or operations
- – denotes private attributes or operations
- # denotes protected attributes or operations
There are 5 kinds of relationship between classes.
Inheritance
class SubClass : SuperClass
{
}

Realization
class SomeClass : ISomeInterface
{
}

It’s inheritance if the class inherits a super class.
It’s realization if the class extends an interface.
Composition
class Person
{
public Profile Info;
}

Aggregation
class Pet
{
public Person Owner;
}

If the target class can exist independently, it’s agrregation. Otherwise it’s composition. You can think the composition is a part-of relationship. You can say the profile is part of somebody, but you cannot say a person is part-of a pet.
Dependency
class Person
{
public Eat(Food food)
{
// ...
}
}

great tutorial!I think there is a mistake in the arrow direction of the realization example.
LikeLike