{"id":78,"date":"2010-10-27T06:31:00","date_gmt":"2010-10-27T06:31:00","guid":{"rendered":"https:\/\/sandrock.co.za\/carl\/2010\/10\/27\/factors-to-consider-when-choosing-a-programming-language\/"},"modified":"2010-10-27T06:31:00","modified_gmt":"2010-10-27T06:31:00","slug":"factors-to-consider-when-choosing-a-programming-language","status":"publish","type":"post","link":"https:\/\/sandrock.co.za\/carl\/2010\/10\/factors-to-consider-when-choosing-a-programming-language\/","title":{"rendered":"Factors to consider when choosing a programming language"},"content":{"rendered":"<p>This morning a colleague and I spoke briefly about choosing a programming language for some high-performance scientific computing (thermodynamic calculations) he wants to do.  I started writing an e-mail with a couple of my thoughts, and then thought it would make a pretty good blog post for the same amount of time.  So here&#8217;s my list of things to consider when choosing a programming language.  Note that these are not orthogonal to one another &#8211; many seem to describe the same thing from different angles.  This is just my musings, not a research study.<\/p>\n<ol>\n<li><span style=\"font-weight: bold\">Popularity<\/span>.  This is a very important one.  A good place to start is the <a href=\"http:\/\/www.tiobe.com\/index.php\/content\/paperinfo\/tpci\/index.html\">Tiobe index<\/a>.  You are more likely to find people to collaborate with if  you use a popular language.  You are also more likely to find reference material and other help.  Unfortunately, the most popular language globally may not be a good match for your problem domain.<br \/><span style=\"font-weight: bold\"><\/span><\/li>\n<li><span style=\"font-weight: bold\">Language-domain match<\/span>. Choose one that matches your problem domain.  You can do this by looking at what other people in your field are using (after adjusting for popularity, so don&#8217;t think the match with Java is good simply because a lot of people are using Java) or by looking at some code that solves problems you are likely to have and seeing how natural the mapping is<span style=\"font-weight: bold\">.<\/span><\/li>\n<li><span style=\"font-weight: bold\">Availability of libraries<span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><\/span><\/span><\/span><\/span>. Some would argue that this is the same as the point above, but I don&#8217;t think so.  If there&#8217;s a library that solves your problem well, you&#8217;ll put up with some ugly calling conventions or hassle in the language.<\/li>\n<li><span style=\"font-weight: bold\">Efficiency<\/span>. Languages aren&#8217;t fast &#8211; compilers are efficient.  Look at the efficiency of compilers or interpreters for your language.  Be aware that interpreted code will run an order of magnitude slower than compiled code as a rule of thumb.<\/li>\n<li><span style=\"font-weight: bold\">Expressiveness<span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><\/span><\/span><\/span><\/span><\/span>. The number of lines of code you create per hour is not a strong function of language, so <a href=\"http:\/\/www.paulgraham.com\/avg.html\">favour languages that are expressive or powerful<\/a><span style=\"font-weight: bold\"><\/span><\/li>\n<li><span style=\"font-weight: bold\">Project-size<\/span>. Do you want to be <a href=\"http:\/\/en.wikipedia.org\/wiki\/Programming_in_the_large_and_programming_in_the_small\">programming in the large or programming in the small<\/a>?  Choose a language that supports your use case.<\/li>\n<li><span style=\"font-weight: bold\">Tool support<span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><span style=\"font-weight: bold\"><\/span><\/span><\/span><\/span><\/span>.  Popularity usually buys tool support (and some languages are easier to write tools for).  If you are a tool-oriented user, choose a language with good tool support.  Just read this article on <a href=\"http:\/\/blog.osteele.com\/2004\/11\/ides\">tool mavens vs language mavens<\/a> before you make a choice.<\/li>\n<\/ol>\n<p>Note that all these things have no single right answer: they define the languages on my <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pareto_efficiency\">Pareto front<\/a>.  A good starting point to observe the trade-off between expressiveness and efficiency is the <a href=\"http:\/\/shootout.alioth.debian.org\/\">Computer Shootout<\/a>.  Also check out <a href=\"http:\/\/youinfinitesnake.blogspot.com\/2010\/09\/programming-language-wars-movie.html\">this analysis<\/a> of some of the results.<\/p>\n<p>Of course, a personal blog need some personal input, right?<\/p>\n<p>I happen to know many languages, and the combination I use at the moment is Python for prototyping and Fortran (2003) for speed.  Python is popular (it&#8217;s the second interpreted language on the Tiobe index, after PHP, which sucks for scientific stuff).  It&#8217;s got a really nice set of <a href=\"http:\/\/www.scipy.org\/\">libraries<\/a> for the jobs that I am doing now and makes<a href=\"http:\/\/www.scipy.org\/F2py\"> wrapping Fortran<\/a> code easy.  Fortran has some really good compilers (and the <a href=\"http:\/\/gcc.gnu.org\/fortran\/\">free gfortran<\/a> is pretty good), and suits matrix-oriented programming really, really well.  YMMV<\/p>\n<p>Both of these languages have good tool support in Emacs (my favourite text editor) and Eclipse (which I am slowly picking up).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This morning a colleague and I spoke briefly about choosing a programming language for some high-performance scientific computing (thermodynamic calculations) he wants to do. I started writing an e-mail with a couple of my thoughts, and then thought it would make a pretty good blog post for the same amount of time. So here&#8217;s my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[3],"tags":[122,187],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-programming","tag-choices","tag-ramble"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":0,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}