There are many ways to override methods and classes. In most situations, using a class is more preferable. Rewriting a new class can create conflict. For this, plugins are introduced. All the classes are defined by their interfaces and configured by di.xml files.