🔧 Programmierung5 Useful Python Scripts to Automate CSV Processing(10.09.2026 um 14:00 Uhr)
🔧 Programmierung5 Python Techniques for Efficient Resource Orchestration(11.09.2026 um 14:00 Uhr)
🔧 ProgrammierungFrom Spaghetti Code to Clean Python: A Beginner’s Guide(11.09.2026 um 16:00 Uhr)
🔧 ProgrammierungText Watermarking in Python: Catch Whoever Copies Your Writing(06.09.2026 um 16:00 Uhr)
🔧 ProgrammierungWhy Most Multi-Agent Systems Fail Even When Evaluation Passes(07.09.2026 um 14:00 Uhr)
🔧 ProgrammierungA Beginner’s Guide to World Models(08.09.2026 um 19:27 Uhr)
🔧 Programmierung7 Async Patterns for Running Agents Concurrently in Python(11.08.2026 um 14:00 Uhr)
🔧 ProgrammierungManaging Small Context Windows in Language Models(18.08.2026 um 14:00 Uhr)
🔧 Programmierung5 Useful Python Scripts to Automate CSV Processing(10.09.2026 um 14:00 Uhr)
🔧 Programmierung5 Python Techniques for Efficient Resource Orchestration(11.09.2026 um 14:00 Uhr)
🔧 ProgrammierungFrom Spaghetti Code to Clean Python: A Beginner’s Guide(11.09.2026 um 16:00 Uhr)
🔧 ProgrammierungText Watermarking in Python: Catch Whoever Copies Your Writing(06.09.2026 um 16:00 Uhr)
🔧 ProgrammierungWhy Most Multi-Agent Systems Fail Even When Evaluation Passes(07.09.2026 um 14:00 Uhr)
🔧 ProgrammierungA Beginner’s Guide to World Models(08.09.2026 um 19:27 Uhr)
🔧 Programmierung7 Async Patterns for Running Agents Concurrently in Python(11.08.2026 um 14:00 Uhr)
🔧 ProgrammierungManaging Small Context Windows in Language Models(18.08.2026 um 14:00 Uhr)

🔧 Programmierung 🕛 vor 2 Jahren 3 Min Lesezeit
0

Constants in JS and what do Plato and Aristotle have to do with it

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

It seems to me that juniors view code components as material things, while seniors deal more with ideal categories.

Or maybe it depends on a person's worldview rather than their professional level?



Sometimes during code reviews, I come across code where instead of the constant CAR_WIDTH, the developer used the constant TABLE_WIDTH because it was the first constant he found with a suitable value.



This is a common problem when developers choose a constant based on its value rather than its name. It turned out that the developer doesn't understand the primary purpose of constants. In his view, constants are only for reuse and readability.





Let's recall what Plato and Aristotle had to say about this.



They had their own constant called SHIP_OF_THESEUS.

https://en.wikipedia.org/wiki/Ship_of_Theseus

It was probably named differently in Greek, but we'll write it in Latin and therefore translate it into English.




CODE
const SHIP_OF_THESEUS = {
name: "Ship of Theseus",
parts: ["mast", "hull", "sail"]
};






The constant SHIP_OF_THESEUS in this example symbolizes the unchanging identity of the Ship of Theseus. Its value, which changes over time, represents the material changes.




CODE
// Day 1: Initial state of the ship
const SHIP_OF_THESEUS = {
name: "Ship of Theseus",
parts: ["mast", "hull", "sail"]
};

// Day 2: Developer changes one part of the ship
const SHIP_OF_THESEUS = {
name: "Ship of Theseus",
parts: ["new mast", "hull", "sail"]
};

// Day 3: Developer changes another part of the ship
const SHIP_OF_THESEUS = {
name: "Ship of Theseus",
parts: ["new mast", "new hull", "sail"]
};

// Day 4: Developer changes structure of the part of the ship
const SHIP_OF_THESEUS = {
name: "Ship of Theseus",
parts: {
mast: "new mast",
hull: "new hull",
sail: "sail"
}
};









Ideal (Constant):



SHIP_OF_THESEUS: Every day, this constant represents the ideal essence of the Ship of Theseus. Despite changes in its value, the concept of the ship remains unchanged.






Material (Value of the Constant):



parts: The list of parts of the ship that changes every day. This reflects the material embodiment of the ship, which changes over time.






Plato on Ideal and Material:



The constant SHIP_OF_THESEUS as an ideal form remains unchanged: every day it represents the Ship of Theseus. However, its value (the parts) may change, reflecting material changes.






Aristotle on Form and Matter:



Aristotle would say that the identity of the ship is preserved through its form and function (very similar to duck typing in JS, isn't it?). In our example, although the parts of the ship change, the form of the object (its structure and function) remains unchanged. Every day it is still the same Ship of Theseus, despite changes in its parts.






So what are the actual benefits of using constants?



The main benefit is not readability and reusability. The main benefit is the separation of code into ideal and material (according to Plato) or form and matter (according to Aristotle).



By making this separation, we can change the matter without changing the form.

And we can use the form throughout the program without worrying about matter.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
5 Useful Python Scripts to Automate CSV Processing
1 Quelle
5 Python Techniques for Efficient Resource Orchestration
1 Quelle
From Spaghetti Code to Clean Python: A Beginner’s Guide
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Constants in JS and what do Plato and Aristotle have to do with it

Thematisch verwandte Begriffe: Constants, what, Plato, Aristotle · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...