I was looking at code.golf the other day and I wondered which languages were the least verbose, so I did a little data gathering.

I looked at 48 different languages that had completed 79 different code challenges on code.golf. I then gathered the results for each language and challenge. If a “golfer” had more than 1 submission to a challenge, I grabbed the most recent one. I then dropped the top 5% and bottom 5% to hopefully mitigate most outliers. Then came up with an average for each language, for each challenge. I then averaged the results across each language and that is what you see here.

For another perspective, I ranked each challenge then got the average ranking across all challenges. Below is the results of that.

Disclaimer: This is in no way scientific. It’s just for fun. If you know of a better way to sort these results please let me know.

      • @[email protected]
        link
        fedilink
        English
        82 years ago

        My guess is that this is really a measure of how much abuse the language will tolerate. C# probably lets you get away with a bunch of things (like checking for nulls) that F# requires.

  • aaaaaaadjsf [he/him, comrade/them]
    link
    fedilink
    English
    42 years ago

    Surprised by C# and Java. People always moan that they have too much boilerplate code and something else about how OOP sucks and that makes these languages too verbose, yet they’re close to the top of the chart here for least characters used on average.

    • @[email protected]
      cake
      link
      fedilink
      52 years ago

      C# is what I primarily write at work, and it’s honestly great to work with. The actual business logic tends to be easy to express, and while I do write a some boilerplate/ceremony, most of it is for the framework and not the language itself. Even that boilerplate generally tends to have shorthand in the language.

    • @[email protected]
      link
      fedilink
      42 years ago

      I suspect this is more a symptom of “enterprise” design patterns than the language itself. Though I do think the standard library in Java is a bit more verbose than necessary.

  • @[email protected]
    link
    fedilink
    22 years ago

    I hate Python 3 requires parantes for print. Python 2 accepted print ‘hi’. Vs print(‘hi’)

  • @[email protected]
    link
    fedilink
    42 years ago

    im confused, c and c have header files that are super verbose, not sure how its so high up that list

    • @[email protected]
      link
      fedilink
      52 years ago

      Header files are optional, they duplicate function declarations to share between multiple files, but otherwise you could write c/c++/c# without headers… the compiler might just run out of memory.

  • @[email protected]
    link
    fedilink
    English
    52 years ago

    Super interesting to see that. Didn’t expect Python to have such a lead, but it is understandable.

  • @[email protected]
    link
    fedilink
    102 years ago

    I’m surprised C is so low. I feel like I need to write 5x more code (compared to C++/Rust) to do the exact same thing.

  • @[email protected]
    link
    fedilink
    English
    7
    edit-2
    2 years ago

    Is Dart inherently verbose, or does it just seem that way because people are using it to make Flutter widgets and they’re verbose? When you look at the Dart syntax it doesn’t seem like it needs to be verbose, but Flutter code certainly can be.

  • Semi-Hemi-Demigod
    link
    fedilink
    92 years ago

    This is why I love Ruby: Nearly as concise as Python but never complains about whitespace or indentation.

    • @[email protected]M
      link
      fedilink
      132 years ago

      I’ve never understood the complaint about forced indentation. What kind of monster doesn’t use indentation for their code anyway?

      If anything, it’s nice that the language forces it on you so that you don’t stumble on code written by one of those monsters.

      • @[email protected]
        link
        fedilink
        82 years ago

        For me at least, it’s less about forcing indentation as much as limiting what I can do with visual indentation.

        Sometimes, it’s nice to group lines at a given indentation level for visual comprehension vs the needs of the interpreter.

        And to be fair, I don’t hate Python’s indentation style. It’s usually not a major problem in practice. It’s just that without the ability to override it, I lose a tool for expressing intent.

      • Semi-Hemi-Demigod
        link
        fedilink
        22 years ago

        I write pretty clean code already, and the white space errors just get in the way of getting things done.

        • @[email protected]M
          link
          fedilink
          42 years ago

          Clean code would have indentation though, and you can use whatever space you want as indentation. Bonus points if you use tabs so that others with special needs can configure the tab length on their end.

          And I don’t think I’ve encountered an indentation error since the day I learned the language. How often do you encounter that error when writing python scripts? Sounds more like a theoretical problem than something anyone used to python would encounter.

      • snoweM
        link
        fedilink
        52 years ago

        You can get some bad bugs due to the fact that white space is significant, not because you are using it. For example how is the IDE supposed to know when you’re done writing your if statement? Or done with a loop? It’s impossible. It’s pretty telling that Python is the only language on this list that has significant white space.(somebody please check me on this, but I’m pretty sure I didn’t miss anything here).

  • @[email protected]
    link
    fedilink
    1
    edit-2
    2 years ago

    I’m not familiar with code.golf but I wonder how whitespace is handled? I find python is very concise anyway, but I wonder how the white space is counted (single tab, four spaces for black, etc).

  • @[email protected]
    link
    fedilink
    52 years ago

    Who tf uses OCaml. It was created by my alma mater, we hated studying that shit, it was invented for crazy people.

    • @[email protected]
      link
      fedilink
      92 years ago

      we hated studying that shit

      It’s a more than fine functional programming language if you ask me. Was that the functional aspect that you disliked? Or the syntax? Because in one case like the other I’ve got some bad news for you about what’s to come in the programming languages landscape :)

      Who tf uses OCaml.

      The rust compiler (initially), large financial companies, the energy sector, etc: practically anywhere functional programming shines

      written by a Scala programmer