Concepts

Components

  • Components are modular units of software that encapsulate logic, state, and presentation.

  • They are often used in architectures such as Component-Based Architecture, common in frameworks like React, Vue.js, and Angular.

  • Main characteristics :

    • Encapsulation :

      • A component is an independent entity that can have its own state and internal logic.

    • Reusability :

      • It can be used in different parts of the system without code duplication.

    • Interoperability :

      • It can interact with other components through properties (props), events, or interfaces.

    • Lifecycle :

      • It can have initialization, update, and destruction phases.

Composition

About
  • Composition is a code structuring technique where objects, functions, or components are built by combining smaller, reusable entities.

  • Composition can occur in different forms, such as:

    • Object Composition :

      • An object contains other objects as attributes.

    • Functional Composition :

      • Functions are combined to form processing pipelines.

    • Component Composition :

      • A component is composed of smaller components.

Inheritance vs Composition
In Godot