Design - Concepts and Terminology

General

Casing
  • camelCase :

    • getCookie

  • snake_case :

    • get_cookie

  • PascalCase :

    • GetCookie

Anonymous Functions vs Lambda Functions vs Closures
  • Lambda :

    • They are Anonymous Functions, even smaller, in one line.

  • Closures :

    • An Anonymous Function, but aware of its surroundings.

Operators
  • Unary :

    • Operators operate on a single target (such as -a ). Unary prefix  operators appear immediately before their target (such as !b ), and unary postfix  operators appear immediately after their target (such as c! ).

  • Binary :

    • Operators operate on two targets (such as 2 + 3 ) and are infix  because they appear between their two targets.

  • Ternary :

    • Operators operate on three targets. Like C, Swift has only one ternary operator, the ternary conditional operator ( a ? b : c ).

  • The values that operators affect are operands . In the expression 1 + 2 , the +  symbol is an infix operator and its two operands are the values 1  and 2 .

Compilation / Interpreter
Reflection
  • It is the ability of a program to inspect and manipulate its own structure at runtime.

  • This includes:

    • Listing types, functions, fields, attributes.

    • Getting function argument types.

    • Dynamically creating instances of types.

    • Invoking functions by their names.

  • Function Introspection :

    • A subtype of reflection. Refers specifically to the ability to:

      • Get the function name.

      • View its parameters and types.

      • Know its return type.

      • Inspect attributes.

      • View its source code.

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