Glossary · Automation software engineering and architecture
Polymorphism
German: Polymorphie
In object-oriented programming, polymorphism is the ability to use objects of different types through a common interface, with the operation actually executed depending on the object's concrete type at run time or compile time.
- Software engineering
In one sentence
Polymorphism lets code use objects of different types through one common interface, each executing its own implementation.
Example
The line sequence calls Start on every station through the same interface, and each station function block executes its own start routine.
How it applies
- Engineering: Polymorphism lets a machine framework handle different module types uniformly, for example many drive types behind one axis interface. New types can be added without changing the calling code.
- Maintenance: Because the executed code depends on the object, reading the call alone does not show what runs. Engineering tools that navigate to implementations help service staff.
- Documentation: Document the interface contract once and each implementation's specific behavior separately. Users configuring machines need to know which implementation their variant uses.
Polymorphism vs. inheritance
Inheritance reuses and specializes a base implementation. Polymorphism concerns calling different implementations through one interface; it can be achieved through inheritance or through interfaces without shared implementation.