Skip to content
DevMeme
4788 of 7590
CodeQuality Post #5246 · source on Telegram

The Definitive, Unimpeachable Guide to Code Brace Styles vs. Mental Disorders

Description

An image that presents a strong, humorous opinion on programming code styles for brace placement. The image displays eight different code snippets, each showing a 'while (x == y)' loop with different formatting for the opening and closing curly braces. A light green, hand-drawn circle groups together the 'Allman' and 'Kernighan & Ritchie' styles under the label 'Code styles'. In contrast, a large red, hand-drawn circle encompasses the other six styles: 'GNU', 'Whitesmiths', 'Horstmann', 'Haskell style', 'Ratliff style', and 'Lisp style'. Inside this red circle, the text boldly declares these styles to be 'Mental disorders'. The joke is a satirical take on the 'holy wars' in software development over coding conventions. It hyperbolically suggests that only the two most mainstream C-style brace placements (Allman and K&R) are valid, while all others are signs of derangement. The inclusion of 'Haskell style' and 'Lisp style' is an extra layer of humor, as those languages don't typically use curly braces for control flow, highlighting the absurdity of the argument

Comments

27
Anonymous ★ Top Pick The fastest way to start a flame war in a room of senior engineers isn't to bring up microservices vs. monoliths; it's to show this image and declare that the green circle should be red
  1. Anonymous ★ Top Pick

    The fastest way to start a flame war in a room of senior engineers isn't to bring up microservices vs. monoliths; it's to show this image and declare that the green circle should be red

  2. Anonymous

    We can reach consensus on CAP trade-offs in minutes, but show one GNU brace and the room deadlocks harder than a naïve two-phase commit

  3. Anonymous

    The real mental disorder is spending three hours in a code review arguing about bracket placement while the production database is on fire and nobody's noticed the SQL injection vulnerability on line 47

  4. Anonymous

    After 40 years of programming, I've learned that the real mental disorder isn't your brace style - it's thinking you can win the formatting argument in a code review. The Allman vs K&R debate has claimed more engineering hours than any memory leak, and somehow we still haven't automated this away with prettier/black/gofmt everywhere. The true sign of a senior engineer? Accepting that the codebase uses Whitesmiths style and moving on with your life, because that legacy COBOL migration isn't going to architect itself

  5. Anonymous

    After the hundredth PR nit on Allman vs K&R, we made the entire style guide one line: run clang-format - turns out the only scalable opinion is a bot

  6. Anonymous

    Brace style is a distributed consensus algorithm disguised as a theological dispute - install clang-format as the single source of truth and stop running Paxos at every pull request

  7. Anonymous

    We've mastered Raft consensus for clusters, but brace styles still partition every PR

  8. @grey_five_9 3y

    Lisp style looks sexy, not gonna lie...

    1. @callofvoid0 3y

      In large blocks you may lose track of brackets

    2. @ArctanK 3y

      but it doesn't actually use this style cause it doesn't even have brackets

    3. @RiedleroD 3y

      mental disorder: diagnosed

  9. @r1gor 3y

    allman fans and kernighan & ritchie enjoyers

  10. @ArctanK 3y

    it has parenthesis, but it is completely fine to style parenthesis like this

  11. @ArctanK 3y

    haskell also doesn't have brackets

  12. @ArctanK 3y

    it is actually fun to write haskell code (I like category theory)

  13. @SomeWhereIBelong 3y

    Only right way

    1. @Araalith 3y

      С#/Java agent provocateur detected.

      1. @SomeWhereIBelong 3y

        Wrong Im a C++ dev

    2. @unknwnOlg 3y

      I think this is right version

  14. @paul_thunder 3y

    GNU is fine

    1. @sylfn 3y

      a cat is fine too

      1. @paul_thunder 3y

        cat? i`m drunk and may be missing something

        1. dev_meme 3y

          Google the phrase

        2. @RiedleroD 3y

          https://knowyourmeme.com/memes/a-cat-is-fine-too

  15. @callofvoid0 3y

    jython

  16. @sylfn 3y

    the only mental disorder

  17. @karumsenjoyer 3y

    Python: look what they need to mimic a fraction of our power

Use J and K for navigation