News for hackers. Stuff that matters.
Re:Google Code Jam 2011 Language Popularity by Dn_Ab on Sunday May 08, 2011 @09:25AM (#2525833)
I was curious as to what proportion of each language achieved a perfect score. A quick script [1] sorted by Percent which reached perfect score and then by qualified resulted in the below - mean of advanced/lang is: ~90%, most (26) langs either achieved 100% entry or around 80% (14) ).

  [|("PostScript", (1, [|1.0; 1.0; 1.0|]));
    ("Brainfuck", (2, [|1.0; 1.0; 1.0|]));
    ("Golfscript", (2, [|1.0; 1.0; 1.0|])); 
    ("COBOL", (1, [|1.0; 1.0; 1.0|]));
    ("Octave", (3, [|1.0; 1.0; 0.6666666667|]));
    ("Shell", (5, [|1.0; 1.0; 0.6|])); 
    ("dc", (2, [|1.0; 1.0; 0.5|]));
    ("sed", (2, [|1.0; 1.0; 0.5|])); 
    ("R", (2, [|1.0; 1.0; 0.5|]));
    ("OCaml", (21, [|1.0; 1.0; 0.380952381|]));
    ("F#", (17, [|1.0; 0.8235294118; 0.3529411765|]));
    ("D", (6, [|1.0; 0.5; 0.3333333333|]));
    ("Prolog", (3, [|1.0; 1.0; 0.3333333333|]));
    ("J", (3, [|1.0; 0.6666666667; 0.3333333333|]));
    ("Clojure", (17, [|1.0; 0.9411764706; 0.2941176471|]));
    ("Haskell", (118, [|1.0; 0.906779661; 0.2457627119|]));
    ("C++", (5700, [|1.0; 0.9080701754; 0.2022807018|]));
    ("ActionScript", (5, [|1.0; 0.8; 0.2|]));
    ("Lua", (12, [|1.0; 0.75; 0.1666666667|]));
    ("Pascal", (111, [|1.0; 0.8738738739; 0.1621621622|]));
    ("Python", (1658, [|1.0; 0.8805790109; 0.1447527141|]));
    ("Ruby", (259, [|1.0; 0.8918918919; 0.1351351351|]));
    ("Lisp", (26, [|1.0; 0.8076923077; 0.1153846154|]));
    ("C", (671, [|1.0; 0.8032786885; 0.1117734724|]));
    ("Java", (2652, [|1.0; 0.8465309201; 0.1052036199|]));
    ("C#", (710, [|1.0; 0.8309859155; 0.0985915493|]));
    ("Perl", (155, [|1.0; 0.8258064516; 0.09677419355|]));
    ("MATLAB", (11, [|1.0; 0.8181818182; 0.09090909091|]));
    ("Scala", (35, [|1.0; 0.8; 0.08571428571|]));
    ("Groovy", (13, [|1.0; 1.0; 0.07692307692|]));
    ("Javascript", (30, [|1.0; 0.6666666667; 0.06666666667|]));
    ("GO", (16, [|1.0; 0.8125; 0.0625|]));
    ("PHP", (166, [|1.0; 0.765060241; 0.05421686747|]));
    ("Visual Basic", (32, [|1.0; 0.78125; 0.03125|]));
    ("Assembly", (1, [|1.0; 1.0|])); 
    ("AWK", (3, [|1.0; 1.0|]));
    ("WRAPL", (1, [|1.0; 1.0|])); 
    ("Standard ML", (2, [|1.0; 1.0|]));
    ("Objective-C", (6, [|1.0; 1.0|])); 
    ("TCL", (3, [|1.0; 1.0|]));
    ("Mercury", (1, [|1.0; 1.0|])); 
    ("Befunge", (1, [|1.0; 1.0|]));
    ("Fortran", (2, [|1.0; 1.0|])); 
    ("Factor", (2, [|1.0; 1.0|]));
    ("CMake", (1, [|1.0; 1.0|])); 
    ("LOLCODE", (1, [|1.0; 1.0|]));
    ("LOGO", (1, [|1.0; 1.0|])); 
    ("Boo", (1, [|1.0; 1.0|]));
    ("Erlang", (5, [|1.0; 0.8|])); 
    ("Scheme", (7, [|1.0; 0.5714285714|]))|]
[1]

  str |> Array.map (fun s -> let spl = s.Split('\t')  
                             (spl.[0] , let scspl = spl.[spl.Length - 1].Split('/') in
                                        scspl.[0], scspl |> Array.map (fun sc -> float sc / float scspl.[0] )))
      |> Array.sortBy(fun (_,(_,sc)) -> if sc.Length = 3 then -sc.[2] else 1./sc.[1])
Re:Google Code Jam 2011 Language Popularity by T-R on Sunday May 08, 2011 @04:23PM (#2526648)
Reformatted:

    PostScript      1    1.0   1.0            1.0
    Brainfuck       2    1.0   1.0            1.0
    Golfscript      2    1.0   1.0            1.0
    COBOL           1    1.0   1.0            1.0
    Octave          3    1.0   1.0            0.6666666667
    Shell           5    1.0   1.0            0.6
    dc              2    1.0   1.0            0.5
    sed             2    1.0   1.0            0.5
    R               2    1.0   1.0            0.5
    OCaml          21    1.0   1.0            0.380952381
    F#             17    1.0   0.8235294118   0.3529411765
    D               6    1.0   0.5            0.3333333333
    Prolog          3    1.0   1.0            0.3333333333
    J               3    1.0   0.6666666667   0.3333333333
    Clojure        17    1.0   0.9411764706   0.2941176471
    Haskell       118    1.0   0.906779661    0.2457627119
    C++          5700    1.0   0.9080701754   0.2022807018
    ActionScript    5    1.0   0.8            0.2
    Lua            12    1.0   0.75           0.1666666667
    Pascal        111    1.0   0.8738738739   0.1621621622
    Python       1658    1.0   0.8805790109   0.1447527141
    Ruby          259    1.0   0.8918918919   0.1351351351
    Lisp           26    1.0   0.8076923077   0.1153846154
    C             671    1.0   0.8032786885   0.1117734724
    Java         2652    1.0   0.8465309201   0.1052036199
    C#            710    1.0   0.8309859155   0.0985915493
    Perl          155    1.0   0.8258064516   0.09677419355
    MATLAB         11    1.0   0.8181818182   0.09090909091
    Scala          35    1.0   0.8            0.08571428571
    Groovy         13    1.0   1.0            0.07692307692
    Javascript     30    1.0   0.6666666667   0.06666666667
    GO             16    1.0   0.8125         0.0625
    PHP           166    1.0   0.765060241    0.05421686747
    Visual Basic   32    1.0   0.78125        0.03125
    Assembly        1    1.0   1.0           
    AWK             3    1.0   1.0           
    WRAPL           1    1.0   1.0           
    Standard ML     2    1.0   1.0           
    Objective-C     6    1.0   1.0           
    TCL             3    1.0   1.0           
    Mercury         1    1.0   1.0           
    Befunge         1    1.0   1.0           
    Fortran         2    1.0   1.0           
    Factor          2    1.0   1.0           
    CMake           1    1.0   1.0           
    LOLCODE         1    1.0   1.0           
    LOGO            1    1.0   1.0           
    Boo             1    1.0   1.0           
    Erlang          5    1.0   0.8           
    Scheme          7    1.0   0.5714285714
Re:Google Code Jam 2011 Language Popularity by zmitri on Sunday May 08, 2011 @04:21AM (#2525493)
I think its surprising to see such little growth in number of users using python from last year. http://www.go-hero.net/jam/11/languages vs http://www.go-hero.net/jam/10/languages/0

I answered all the questions using python and was surprised to see the majority of the top coders (you know, the guys who solved everything in ~30 minutes) use C++ and Java. I had the impression that the difference in python's runtime would be made up for how much more succinctly you can code in it and by all the syntactic sugar... but I guess not. In fact, I noticed some of the top guys have various built in libraries to help them reduce their time spent on input handling and various solver interfaces. The auto generated code from those libraries dwarves the actual solution code in size.

Re:Google Code Jam 2011 Language Popularity by greyman on Sunday May 08, 2011 @05:14AM (#2525547)
Maybe that's because the verboseness of C++ or Java isn't really that much of a problem, since the experienced coders can usually type quickly, and moreover, most of the programming work is thinking, not typing.
Re:Google Code Jam 2011 Language Popularity by random42 on Sunday May 08, 2011 @05:17AM (#2525550)
Also, the experienced coders also already have template macros for frequently used code snippets, like loop, conditional statements, comparisions, sorting etc., making doing trivial things in C++/Java, as trivial as doing them in Python (or other high level language).
Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:21PM (#2526423)
Yup. Some of the TopCoders have their own templates that include substituting "for" with "F" and the like.

They'd have solved these kinds of questions for years, and have ready templates for parsing the input and output.

Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:26PM (#2526430)
The verboseness, because of the need to type more code is never a major problem.

Verboseness is indicative of the abstractions that are exposed, and that being at a lower level than necessary is the problem because you don't just have to deal with the problem at hand, but also the holes in languages.

With years of practice in a similar area, many people would have their own libraries to abstract those language shortcomings.

In general, the verbosity because of the bad abstraction levels is always a problem, because different people using it will have their own versions to patch them up.

Re:Google Code Jam 2011 Language Popularity by BasDirks on Sunday May 08, 2011 @06:04AM (#2525601)
C(++)/Java are really popular in most coding competitions, but I don't know if that necessarily says anything. Recently a very decent competition (anyone remember?) was won by someone coding in Pascal.
Re:Google Code Jam 2011 Language Popularity by olalonde on Sunday May 08, 2011 @07:05AM (#2525695)
Somewhat educated guess, but it probably has to do with the fact that those contests offer well defined, immutable specifications. No need to iterate a lot or refactor much.
Re:Google Code Jam 2011 Language Popularity by killedbydeath on Sunday May 08, 2011 @02:07PM (#2526391)
Curious what you are trying to say. I program mostly in Python, but never considered ease of refactoring to be its strength. I felt more comfortable changing code in C++ mostly because of the static typing providing additional correctness guarantees at run-time.
Re:Google Code Jam 2011 Language Popularity by Tichy on Sunday May 08, 2011 @07:17AM (#2525709)
I think TopCoder only allows some languages (including Java), maybe that is part of the reason.
Re:Google Code Jam 2011 Language Popularity by BasDirks on Sunday May 08, 2011 @09:01AM (#2525801)
Look at this guy: http://www.go-hero.net/jam/11/name/Soultaker

Used Haskell, PostScript, Python, Prolog, Perl, J, Brainfuck, C, each once for one problem.

Re:Google Code Jam 2011 Language Popularity by olalonde on Sunday May 08, 2011 @05:32AM (#2525567)
Basically, the 2 most hated languages on HN are the 2 most popular for the Google Code Jam?
Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:30PM (#2526438)
Just like how McDonalds always does more business than FreshGreens(Or whatever that is).
Re:Google Code Jam 2011 Language Popularity by lawn on Sunday May 08, 2011 @05:21AM (#2525556)
Perfect score with brainfuck, that's pretty funny.
Re:Google Code Jam 2011 Language Popularity by FaceKicker on Sunday May 08, 2011 @06:27AM (#2525628)
And...CMake? What?
Re:Google Code Jam 2011 Language Popularity by kentbuckle on Sunday May 08, 2011 @05:34AM (#2525568)
Props to the befunge coder as well
Re:Google Code Jam 2011 Language Popularity by orangecat on Sunday May 08, 2011 @12:13PM (#2526136)
The country distributions are interesting: Python was used much more frequently in the US, while India favors Java and China favors C++.
Re:Google Code Jam 2011 Language Popularity by ianl on Sunday May 08, 2011 @10:35AM (#2525935)
I think its important to note that many coding competitions historically only allow C/C++/Java. There is advantage in that you can use many hacks in these languages to get around certain issues quickly if your an innovative person (which you have to be to do the contest questions).
Re:Google Code Jam 2011 Language Popularity by zbanks on Sunday May 08, 2011 @01:36PM (#2526325)
When I started, I was thinking about using JS both "for the lulz" and because I'm comfortable enough with it that it wouldn't be a hindrance, like LOLCODE or Befunge.

I went with python instead because I assumed I'd need to squeeze as much efficiency as possible out of my programs.

For this round, these fears were completely unwarranted. All of the problems, except the second, were trivially O(n). (#2 wasn't worth optimizing, but it was possible)

Does anyone have experience with the next round? Is speed still not really an issue?

Re:Google Code Jam 2011 Language Popularity by neutronicus on Sunday May 08, 2011 @10:30AM (#2525926)
I tried to use Haskell, and I think that choice bit me (not Haskell's fault, I hasten to add). I saw the correct solutions right away, but I was nowhere near good enough at recognizing the causes of type errors and I/O in general to produce them in the amount of time I had (I started late). C'est la vie. Learning experience.
Re:Google Code Jam 2011 Language Popularity by Tichy on Sunday May 08, 2011 @07:05AM (#2525696)
I just looked at the top scoring solution, written in C++, and a Java solution next to mine in the scoreboard, and I can only say that I am really happy with my choice of Ruby.

As for the top scorer, I can't help but wonder if that skill even translates well to the real world?

Re:Google Code Jam 2011 Language Popularity by agile_zergling on Sunday May 08, 2011 @02:20PM (#2526422)
Hang out on the topcoder message boards and decide for yourself.
Re:Google Code Jam 2011 Language Popularity by spullara on Sunday May 08, 2011 @01:50PM (#2526359)
So did Google choose C++/Java/Python as their standard languages or are they just the natural standard languages of the industry? Was there any push by Google to those 3 languages aside from developers knowing that is what they use internally?
Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:17PM (#2526417)
Google doesn't care what language you use, or in fact even if you compute it manually. All they need is a output file that confirms with their output. - You can provide, whatever the sources.

These are of course, the standard industry choices these days. Except there is a huge bias for C++, as for most competitors, that is a standard language.

Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:22PM (#2526426)
Here is my (succinct) solution for the Q1: https://gist.github.com/960549
Re:Google Code Jam 2011 Language Popularity by Scaevolus on Sunday May 08, 2011 @10:47PM (#2527352)
Elegant code golf? :D https://gist.github.com/961961
Re:Google Code Jam 2011 Language Popularity by bugsy on Sunday May 08, 2011 @02:35PM (#2526444)
I enjoy seeing a positive number in the column for number of contest entries written in brainfuck.
Re:Google Code Jam 2011 Language Popularity by scorpion032 on Sunday May 08, 2011 @02:18PM (#2526419)
Seems to indicate Haskell is 7 times as popular as Clojure.
Re:Google Code Jam 2011 Language Popularity by pshapiro on Sunday May 08, 2011 @12:12PM (#2526135)
Why was C++ so popular?
Re:Google Code Jam 2011 Language Popularity by rednum on Sunday May 08, 2011 @04:57PM (#2526717)
C++ and java seems to be two languages allowed in all algorithmic competitions and people are used to it. I think reasons for which C++ is the dominant one are a bit historical - for example when I started participating in those contests, all my friends used C++ and recommended me to learn it too (though now I think I'd stick with java; and in gcj I used common lisp).
Re:Google Code Jam 2011 Language Popularity by Garbage on Sunday May 08, 2011 @12:28PM (#2526172)
Speed IMO.
Re:Google Code Jam 2011 Language Popularity by vlisivka on Sunday May 08, 2011 @04:27AM (#2525500)
Wow - five coders use bash as their favorite language (including me :) ).