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.
Not expected C# to be this high. Also did not expected F# be so far away from C#.
In newer versions of C# you can use top level statements, which remove a lot of characters
Yeah that seems suspicious. F# is pretty succinct.
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.
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.
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.
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.
I think Java’s verbosity has more to do with the culture than the language itself
I hate Python 3 requires parantes for print. Python 2 accepted print ‘hi’. Vs print(‘hi’)
Why would golfscript be more verbose than some others? Isn’t it made for golfing?
Rest in pieces golfcels it’s pychad time
im confused, c and c have header files that are super verbose, not sure how its so high up that list
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.
What the heck is brainfuck?? Maybe a hot take but I wouldn’t wanna program in that /s
https://en.m.wikipedia.org/wiki/Brainfuck
For those wondering (like myself)
------[–>+++<]>.--------.-.----------.+.+++++++++++++.[–>+++++<]>+++.+[->+++<]>+.+…[—>+<]>+++.++[---->+<]>+.+[----->+<]>+.+++++++.-.++++++.
Bless you
Super interesting to see that. Didn’t expect Python to have such a lead, but it is understandable.
import codegolf codegolf.challenge1()
Yeah, they should count lines including the libraries, interesting to see where python would end up then.
Rust is so brief it’s not even listedI can’t readIt is there, its the 20th. I was searching for that as well.
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.
You have not read enough code from IOCCC.
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.
Idk, in my short experience with it, it feels very Java like in verbosity
This is from codegolf competitions, so non-Flutter I’d assume.
This is why I love Ruby: Nearly as concise as Python but never complains about whitespace or indentation.
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.
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.
I write pretty clean code already, and the white space errors just get in the way of getting things done.
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.
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).
I’m suprised by F# position
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).
Any idea how Scala would rank? I have a hard time thinking it’d end up far away from Ruby.
Who tf uses OCaml. It was created by my alma mater, we hated studying that shit, it was invented for crazy people.
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
Seems quite nice compared to bloody scheme