Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungFirst-touch attribution on a cookieless static Nuxt site(21.09.2026 um 02:51 Uhr)
Sichere ProgrammierungWho Is the Customer? It Might Not Be Who Uses the Product(21.09.2026 um 02:57 Uhr)
Sichere ProgrammierungOn My Japanese Team, We Greet Each Other by Saying "You Must Be Tired"(21.09.2026 um 03:06 Uhr)
Sichere ProgrammierungRedis vs Memcached: Complete Comparison(21.09.2026 um 03:16 Uhr)
Sichere ProgrammierungHow Databricks Serverless Compute Cost My Team $14k in One Weekend(21.09.2026 um 03:20 Uhr)
Sichere ProgrammierungStop trying to make Airflow work for Medallion pipelines(21.09.2026 um 03:21 Uhr)
Sichere ProgrammierungI built an app that turns workout videos into actual workouts(21.09.2026 um 03:39 Uhr)
Sichere ProgrammierungFirst-touch attribution on a cookieless static Nuxt site(21.09.2026 um 02:51 Uhr)
Sichere ProgrammierungWho Is the Customer? It Might Not Be Who Uses the Product(21.09.2026 um 02:57 Uhr)
Sichere ProgrammierungOn My Japanese Team, We Greet Each Other by Saying "You Must Be Tired"(21.09.2026 um 03:06 Uhr)
Sichere ProgrammierungRedis vs Memcached: Complete Comparison(21.09.2026 um 03:16 Uhr)
Sichere ProgrammierungHow Databricks Serverless Compute Cost My Team $14k in One Weekend(21.09.2026 um 03:20 Uhr)
Sichere ProgrammierungStop trying to make Airflow work for Medallion pipelines(21.09.2026 um 03:21 Uhr)
Sichere ProgrammierungI built an app that turns workout videos into actual workouts(21.09.2026 um 03:39 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Naming Things Without Pain

Reagiere als Erste:r — dein Feedback zählt!

Naming Things Without Pain

Naming things is one of the two hard problems in computer science (the other being cache invalidation and off-by-one errors). We've all stared at a variable or function, unable to think of a good name. Here are practical strategies to reduce that pain.

Use Intention-Revealing Names

A name should answer "why it exists, what it does, and how it is used." Avoid generic names like data, info, temp, or flag. Instead, be specific.

# Bad
d = 86400  # what does this mean?

# Good
seconds_in_a_day = 86400

Pronounceable Names

If you can't say it in a conversation, it's a bad name. genymdhms (generate date, year, month, day, hour, minute, second) is impossible to pronounce. Use generation_timestamp instead.

Avoid Disinformation

Don't use names that imply something different. For example, account_list should be a List, not a HashMap. If it's a set, call it account_set or accounts.

Use Consistent Naming Conventions

Pick a style and stick to it. For example:

  • camelCase for JavaScript variables and functions: getUserById
  • snake_case for Python variables: get_user_by_id
  • PascalCase for classes: UserService

Consistency reduces cognitive load.

Distinguish Names Meaningfully

Avoid number-series naming like a1, a2, a3 unless they have specific meaning (e.g., coordinates). Also avoid noise words like ProductInfo vs ProductData they are interchangeable. Instead, use Product and ProductDetails if they differ.

Use Searchable Names

Single-letter names are only acceptable for short-lived loop counters. Otherwise, use names that can be easily searched. e is hard to find; error_message is easy.

// Bad
int e = 7;  // what does e mean?

// Good
int max_items_per_page = 7;

Class and Function Naming

  • Classes should have noun or noun phrase names: Customer, WikiPage, Account.
  • Functions should have verb or verb phrase names: save, delete, getAddress.

The Rule of Three

If you write a name and later find it doesn't fit, rename it. Don't live with a bad name. Refactoring tools make renaming easy. The rule of three: if you use a name three times and it feels wrong, change it.

Example Refactoring

Let's refactor a poorly named function:

// Original
function x(a, b) {
  return a + b / 100;
}

// After
function calculatePriceWithTax(basePrice, taxRatePercent) {
  return basePrice + (basePrice * taxRatePercent / 100);
}

The second version is self-documenting.

Summary

  • Names should reveal intent.
  • Be consistent with conventions.
  • Make names pronounceable and searchable.
  • Rename when the name doesn't fit.

Naming is hard, but with practice it becomes easier. Start with these guidelines and your code will be more readable and maintainable.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Naming Things Without Pain

Thematisch verwandte Begriffe: Naming, Things, Without, Pain · 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 ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93974 | A flaw has been found in SourceCodester Online Reviewer Management Syste…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick