An example of design patterns
The best example of a design pattern is the Command pattern.
What does the command pattern do?
Do you know how to program an undo or redo command? No?
This works with the command pattern.
So what do design patterns do?
They give you solutions to standard problems from object-oriented programming.
Subdivision of the design pattern
Thereby divide the design patterns - programming homework - in three main areas , there are also other areas, but these are the most important first.
- Generation pattern : Abstract Factory, Singleton, Builder, Factory Method, Multiton, Prototype, ...
- Structural pattern : adapter, bridge, container, decorator, facade, flyweight, composite, proxy, ...
- Behavioral patterns : Observer, Visitor, Interpreter, Iterator, Command, Memento, Nullobject, Strategy, Mediator, State, ...
The creation patterns solve problems in creating objects from classes (also if you want to know about Python look it here python programming assignments ). There are different cases with which you can create new objects. The best known are the singleton and the factory .
- The singleton ensures that only one object of a class can be created at a time.
- The factory is like a factory, it produces objects and gives them back to the "customer".
The structure patterns help you to set up and structure your program neatly - help me do my homework . If you explain to another developer that you have programmed a container, they will know exactly what you are talking about.
The behavior patterns solve a certain task. The observer, for example, is there to observe a certain object and then to notify other objects if something changes. In many languages the observer is implemented as an event or delegate.
As already mentioned, the command pattern can be used to program the famous undo command and other functions. There are whole books for design samples alone. You certainly won't need all of the patterns, but with the right experience, you'll want to use these on their own.
Unfortunately, there is also the opposite of design patterns. These are the so-called antipatterns. These are solutions in programs that lead to errors and are difficult to maintain.
You too will at some point have to deal with such antipatterns. You will learn how to deal with this in refactoring.
Chemistry and physics
Economic thinking in antiquity and in the Middle Ages
Object-oriented programming (OOP)