At the end of my post last Monday, I included a link to some statistical computer code (in C++) used to verify some of my observations. I will likely be doing some more of that in the near future, so I thought I'd ask -- What computer language(s) would you find the most useful?
Now, there's a good chance that the results won't actually change what I present. :-) Nonetheless, for those of you who might possibly look at such a thing -- see the poll to the right (options taken from the top of the TIOBE index this month). And, you can select multiple options (rock the approval vote)!
Even though I mostly code in Java and C# for work and I haven't done anything serious in Python in years, I find algorithms easiest to follow in Python, by far.
ReplyDeleteI think the choice is influenced by what is considered 'useful'. Do you want people to read and understand it, do you want them to incorporate it into software, etc. ?
ReplyDeleteIf it's for web-based use, Javascript would probably be the best choice as its available in every browser. It's also most likely understood by the largest audience.
There’s always R as well—it’s designed specifically for statistical work.
ReplyDeleteI used it for Are My Dice Random? It was the first time I used it and it worked pretty well.
Python and Ruby tend to reduce the "noise" of declarations and boilerplate that occur in C, C++, and Java. Most modern systems have one or both pre-installed.
ReplyDeleteDoing raw calculation in an interpreted language will be slower, but probably easier to read.
Lua is a small language that has the benefits of clarity and (relative) speed. It's not often pre-installed, though.
JavaScript isn't a bad choice either. Despite the "Java" part of its name and curly braces, it's closer in spirit to Lua or Ruby.
For myself, Java tops the list just because I use it at work, which means I tend to get things dome more quickly with it (even though it's often a case of hammering screws...).
ReplyDeleteAnything that would lend itself to C/C++ I would likely end up doing in Go or Objective-C, depending on platform, mostly for the nice support for managed-thread-like mechanisms (e.g. goroutines).
Anything I want to share I try to do in Javascript/ECMAScript. The langauge itself is pretty nifty, but the ideosyncratic standard libraries, not to mention the lack of a rich set of numeric types, tends to drive me up a wall
Good comments. Rob: The expected use would to "read and understand" it, maybe fiddle with constants, etc. Not intended as a library package or a web application.
ReplyDeleteThe overall point is to generate some statistics that we can then use at the table in pen-and-paper games. (Much like last Monday's post that ended with the -10/-20 ranged penalty proposal.)
In addition to C/C++, I picked other, thinking Perl
ReplyDeleteC or Java are my preferences.
ReplyDeletePerl, then Javascript, but I also would accept Python, even though I don't really know it. At least it's fairly readable...
ReplyDeleteJust about anything is OK in my book. (Except pseudocode, which I find imprecise to the level of pointlessness.) I tend to prefer Scheme for examples myself.
ReplyDeleteMy “other” vote stands for Scheme and Javascript.
Python is designed to be highly readable I find it really useful for examples. Plus it's great.
ReplyDeleteAt work I use Java; at home I use Perl and Emacs Lisp. When it comes to code samples, however, I think you should pick a language that you are comfortable and which produces the shortest possible piece of code. Reading boiler plate code is boring.
ReplyDeletePython as it's readable, powerful and cross platform, or C because it's simple, powerful and cross platform. C++ restricts the possible readership.
ReplyDeleteThe only language that ever made sense to me is lisp.
ReplyDeleteYou know you want to. :)
One of my gaming jobs used Lisp as part of the production environment. Ne'er again! :)
ReplyDeleteBut it would be far more compact that C++ is.
ReplyDeleteAnyway. Cool that you are sharing. Thanks for that. I can't stand the C/Algol family myself, but the nuttiness is widespread.
Perl for data/text handling, scripting and networky stuff. In general, if I need to write a tool, I go for Perl.
ReplyDeleteJava if i feel object orientated, like scenarios with lots of different actors and odd things interacting together.
Haskell if I have to write stuff like assemblers, digital circuits and general mad things that can be better pictured as "we have this data and we need to masticate it in really complex ways till it looks like that"
In general tho, Test Driven Development is what I go for :)
I generally prefer something easy to read.
ReplyDeletePerl for anything involving text. Ruby for anything more serious or the need to be object-oriented.
Java and Python are also ok.