🧠 Second Brain

Search

Search IconIcon to open search

Declarative vs. Imperative

Last updated Feb 9, 2024

Gremlin traversals can be crafted in imperative ( procedural), declarative ( descriptive), or a combination of both styles.

Imperative Gremlin Traversals dictate the exact steps for traversers. For example, an imperative traversal might start with a traverser at the Gremlin vertex, then branch out to Gremlin’s non-Gremlin collaborators, and finally to their managers, culminating in a distribution of manager names. This method explicitly directs the traversers, outlining a clear, procedural path.

Declarative Gremlin Traversals, in contrast, do not specify the traversal order. Instead, they allow traversers to choose from a set of (potentially nested) patterns. A declarative traversal, while achieving the same outcome as its imperative counterpart, benefits from both compile-time and runtime query planning. The latter selects the most efficient traversal pattern based on historical data patterns, prioritizing those that most effectively reduce or filter data.

More details can be found in TinkerPop’s Gremlin documentation.


Declarative vs. Imperative Overview

# Example from Ascend.io

Example of a declarative traversal from Ascend.io.

Full picture:

Further reading includes Ascend’s insights on Declarative Pipeline Workflows & DataOps Challenges, What is Data Orchestration?, and Declarative Pipelines to DataOps Workflows.

This concept is closely linked with DevOps, where tools like Kubernetes and Descriptive Configs - YAML have revolutionized deployment practices. A similar transformation is needed in data pipelines to enhance stability, accelerate development cycles, and ensure scalability.


Origin: Ascend.io
References: Dagster
Created: