33 comments

[ 4.2 ms ] story [ 40.6 ms ] thread
Love stuff like this. Wonder if C is that popular or if its verbosity is skewing the results?
Yes, its verbosity is skewing the results. Same with PHP, C++, and Java. We can see that Ruby is the most popular language on Github here http://github.com/languages, with 28% of all projects being in Ruby. C, PHP, Java, and C++ rank 6%, 5%, 4%, and 4% respectively.
How do you know it's verbosity skewing results, and not a preference for certain languages depending on the size of the project?
The only way to account for that is to compensate for verbosity between languages. I'm not sure anyone wants to go there, it's not pretty.
You can potentially have a sample of programs implemented in many different languages and compare the length of each program across languages. With enough programs you should be able to get a good enough sample as long as they are diverse enough.
Good point.

Also, I wonder how those would be weighted if you counted projects that consist of >90% identical code as the same project (for example, how many of those Ruby projects are thinly veiled forks of Rails?), filtered out projects that are less than (say) 10k of source, etc. Maybe more Python projects are on bitbucket because of Merucial.

The 90% and 10k there are pretty arbitrary; just, those language stats need a lot more clarification before their meaning is clear.

I wonder if you could pull all the projects into one repo, repack and figure out it's unique objects using git. I always wondered if a global object store was possible or even a good idea for a site like github. I guess that's a different project though.
FWIW, finding duplicated code (particularly in a language-independent manner!) is a surprisingly difficult problem. You need to scan not just for large copy-and-pasted blobs, but code chunks that have just had constants changed, variable names adjusted, indentation style changes, etc. I've been working on a tool for this in my spare time, and I hope to have it out sometime this summer.
(comment deleted)
Or perhaps since Rails/Ruby is trendy, a lot of projects get started in Ruby, but never finished.

I'd like to see some language stats broken down by activity on the project.

That's the direction we want to take it.
"a lot of projects get started in Ruby, but never finished."

how do you know that?

Time to invoke Sturgeon's law and mangle it a bit.

90% of all projects are junk.

The C projects could also be more complete and mature. Everyone and their mother has a 50 line Ruby twitter-client/blog/wiki implementation up on Github. I would also argue that the presence of a Linux kernel mirror, Perl mirror, Android (including the Linux kernel, again), and large projects like them skews the byte vs projects percentages a great deal.
The top languages calculation on GitHub is done by lines of code per language. By that calculation, there are 4.5x more Ruby LOC than C LOC on Github, yet C is still has the most bytes.

http://github.com/blog/99-popular-languages

I'm pretty sure that lines of Ruby code tend to be shorter than lines of C. Static typing annotations tend to add to line length more directly than line count.
That blog post is no longer accurate. We don't count LOC for language popularity, we count the number of non-fork projects that include a language.

If your project includes both Ruby and Perl, Ruby and Perl each get a +1.

That doesn't mean they're the most popular. It might be people all sharing stuff to say "look how retarded this code is."

(just saying)

C is popular:

http://langpop.com

However, in this case, yeah, verbosity is skewing things. Also, it should be noted that github numbers, like stack overflow, are still influenced by big initial communities with strong biases (Ruby, and C#, respectively).

Still, though, interesting numbers, thanks!

Perhaps it's because of the linux kernel?
Interesting. A good example that illustrates why C is the top language is _why's shoes -- it's written mostly in C, but still belongs to Ruby-land.
So is potion, _why's project du jour (though it doesn't have any relevance to Ruby).

On a side note - is anyone here following potion's development?

371 people are, according to github :)
cloc does a rough estimation of the terseness/verbosity of the almost 80 languages it supports. It'd be pretty easy to incorporate those scaling factors for this analysis.
I know that I personally have a Clojure project that has many more lines of JavaScript than Clojure just because I have a large JavaScript library checked in with my other code.

I wonder if there's a way to figure out unique lines of code, or unique files. jQuery really shouldn't be counted 5000 times, I would think.

We exclude certain paths, especially popular JavaScript libraries.
My project shows up on github as Shell even though it's in C just because of all the autoconf/automake/libtool files. I imagine that's why Shell places so high on the list.

For example, my 267 line configure.in file produces a 12952 line configure script. And a 6 line Makefile.am gets you a 683 line Makefile.

Don't forget that many projects include jquery, prototype, etc., which add quite a few points to js.
I guess it's not clear to me how you rank popularity by number of bytes (or LOC). I really do like this information though! Thanks!