Skip to content
DevMeme
2772 of 7590
Languages Post #3063 · source on Telegram

Language Features vs. C-Style Naming Conventions

Description

A two-panel meme using the Tom and Jerry format to compare how different programming languages handle naming conflicts. In the top panel, Spike the bulldog, labeled 'C#', and Tom the cat, labeled 'Java', are aggressively sword fighting. Text overlays identify their weapons as 'namespace for handling naming conflicts' and 'package for handling naming conflicts,' respectively, portraying them as modern, combative equals with sophisticated, built-in language features for code organization. The bottom panel shows Jerry the mouse, labeled 'C', looking on with a smug, knowing grin. The caption below him reads, 'Adding some Prefix and suffix to avoid naming conflicts'. The humor lies in the contrast between the elegant, integrated solutions of C# and Java and the manual, convention-based workaround used in C, where the lack of native namespacing forces developers to manually prepend prefixes to function and variable names to prevent collisions in the global namespace. Jerry's expression perfectly captures the pragmatic, if crude, reality of low-level programming

Comments

18
Anonymous ★ Top Pick C++, Java, and C# have namespaces to prevent conflicts. C just squints at the linker errors and adds another underscore to the function name
  1. Anonymous ★ Top Pick

    C++, Java, and C# have namespaces to prevent conflicts. C just squints at the linker errors and adds another underscore to the function name

  2. Anonymous

    Sure, you could design a proper module system - but adding a three-letter company acronym in ALL_CAPS to every symbol is basically the original microservice boundary

  3. Anonymous

    Twenty years later, we're still maintaining that C codebase where gtk_window_new() coexists peacefully with win_window_new(), and somehow it's more maintainable than the microservice that has seventeen layers of dependency injection just to avoid naming a logger

  4. Anonymous

    C's approach to namespace management is like that senior architect who insists 'we don't need microservices, just prefix everything with the team name' - technically it works, you can scale it to millions of lines, but watching C# and Java developers discover `gtk_widget_show()` and `g_object_unref()` for the first time is like watching someone realize their entire codebase could have been three `using` statements

  5. Anonymous

    C#'s namespaces and Java's packages duel elegantly; C just prepends 'g_pwsz' and calls it a namespace

  6. Anonymous

    In C, “modularization” means slapping a libname_ prefix, marking everything else static, and praying the linker’s global namespace doesn’t create an integration test you didn’t schedule

  7. Anonymous

    Namespaces and packages are just socially acceptable prefixes; C skipped the euphemism and lets the linker decide whose init() survives

  8. @LonelyGayTiger 5y

    And this is why I prefer Java

  9. @asm3r 5y

    Js: scopes and everything are variable to handling naming conflicts

  10. @NoCountryForOldBuffet 5y

    C: the way God intended

  11. @Agent1378 5y

    In terms of namespaces and scopes C and c++ are tragedy.

    1. Deleted Account 5y

      there is no any trageny in C++ it supports namespaces and nested namespaces

      1. @cringy_frog 5y

        +

  12. @chupasaurus 5y

    Python: allows monkey patching

  13. @nuntikov 5y

    I actually love the way c does it. Just put a single rare letter in the beginning.

  14. @deerspangle 5y

    Ruby: aaaaa

  15. @Dimarza1 5y

    I love sharpe

  16. @f3rr0us 5y

    Rust: just paths. So good

Use J and K for navigation