web developer & system programmer

coder . cl

ramblings and thoughts on programming...


the language of choice

published: 15-12-2011 / updated: 15-12-2011
posted in: development, programming, projects, tips
by Daniel Molina Wegener

«What is your preferred language?» is a good question I think. From its paradigm to how it should be indented is a good approach to select a language based on the preferences of your programmers. Few days ago I have launched a public poll related to what is the preference in programming language between the people that I meet in social networks. I am very glad to see up to 150 responses to the poll and I am very glad to see that most users have a preference for strictness, rather than fully freedom. So, here are the results of that poll.

programming paradigm

Well, seems that a large amount of users are preferring the well known object oriented paradigm. That means that they prefer to code objects and large statement sequences to solve small problems. A small group prefers other multi-paradigm languages, like Python, Ruby and JavaScript. So, the 67.07% prefers the object oriented paradigm and the 21.95% prefers multi-paradigm languages, the remaining 10.97% prefers functional and procedural paradigms. The problem is the fact that object oriented languages are loosing its purity and are becoming multi-paradigm languages. For example Java has included anonymous functions, like C Sharp does. Also you must remember that Ruby, Python and JavaScript have defined functions as first class inhabitants, so they are multi-paradigm languages.

Preferred Programming Paradigm

Preferred Programming Paradigm

So, I assume that the big percentage that likes object oriented over multi-paradigm languages, do not wants to use anonymous functions and closures on his code, among other features that makes programming more friendly. Is hard to understand that, but I can deal with it. Seems they are very purists. But also you must remember that there are various frameworks using the multi-paradigm approach, rather than being purely object oriented, like jQuery, which uses closures and higher-order functions as its main abstraction. On the statically-typed languages like Java and C Sharp, we have some multi-paradigm approaches too, like LinQ.


type system

Seems that everyone loves the dynamic typing system. A system that allows you to add integers and numeric strings getting an integer as result seems to be cool for many people. Personally, I prefer static typing and strong static typing, because they allow me to introduce less bugs than dynamic typing. So, languages like Ruby, Python and PHP have a preferred type system than Java, C and C++, where both of them have a static typing system, and C Sharp now has a hybrid system, where you can change the type dynamically using var. Static typing allows to cast variables, strong static typing not.

Preferred Type System

Preferred Type System

For example Haskell provides a strong static-typing system, and due to its functional paradigm and its variable immutability, you cannot cast variables, and rather than type casting you should do explicit type conversion using its core functional abstraction. Remember that functional languages usually are state-less languages, so there you cannot change the variables along the execution, and they cannot handle any type casting operation. That is why there are many lift operations in some abstractions like Monoids, where you must use a lifting function on the map() operation. So, 57.14% preferring a dynamic type system is a large amount of developers I think.


compilation type

I am figuring that people prefers much more native compilation rather other types of compilation. For example the sensation of having slow performance on Java applications because they have a heavy disc usage while they are loading libraries for its virtual machine. So, they prefer to compile natively using machine byte-code rather than using virtual machine byte-code. But the difference is not too much between have the option to compile the virtual machine byte-code as native byte-code.

Preferred Compilation

Preferred Compilation

So, having the optional compilation with all options seems to be cool too. For example languages driven by LLVM will probably allow both VM and native byte-code compilation. An example is Haskell, where you can use in-memory compilation — which is done by the command line interpreter and its REPL shell — and its LLVM byte-code compilation, which is commonly used to distribute its binaries. Also, seems that .NET driven applications can be compiled using native byte-code too. I hope that Java will have a similar option in the future, that would be really nice. Also Python provides on-memory compilation on its REPL.


syntax sugar

Well, seems that predefined operator interfaces like Python has, is the preferred language feature, without custom operator like C++ and Haskell have. For example if you want to overload the + operator in your class, you should implement the __add__() method in your class, without having the option to create a new custom operator as +++, that can be defined with a very friendly syntax in both C++ and Haskell. The next group prefers language defined shortcuts, instead of operator overloading and custom operator creation.

Preferred Syntax Sugar

Preferred Syntax Sugar

The problem of those languages without custom operator and operator overloading, is the fact that they cannot be used to define combinatorial operations with a friendly syntax, so you are forced to use method and function calls instead of doing combinatorial operations. Sometimes using combinators is cool, and you can make wonderful stuff using them, like deriving the Y-Combinator to implement recursion without using recursive calls — but this is more like an academic example rather than practical one. At least Python allows you to define your own operator, allowing the implementation of your own combinatorial operations.


indentation

I am very glad to see that a large number of developers prefers to being strict as Python requests, rather than getting freedom about the language indentation. Python requests you that you must indent the code properly, using equal distance between the gap and the code on each block, so if you have a wrong indentation, the code will not compile. Being strict on indentation is cool I think.

Preferred Indentation

Preferred Indentation

Others prefers to indent the code under normative, which is not bad, but can lead to indentation errors, but it is fine. I do not understand people that wants to code without normative, where disallows programmers to create more legible code. So, probably they prefer languages where there are not style checkers to use, like PHP. Is very nice to see that most programmers prefers strictness regarding well indented code and ordered code, making it more legible and more friendly to read.


naming normative

So, a big number of developers prefers to use the camel case naming convention, seems to be more legible than others. But some languages like Python have defined capitalized case for classes and underscores for methods. Otherwise, languages like PHP do not have well meet coding standards, and seems that every project has its own naming convention.

Preferred Normative

Preferred Normative

This is probably a big problem on code legibility, but not at all. Is betters to have people that agree with standard usage rather than avoiding them. Well, camelCase is widely used, I agree with it, but I do not have any problem on switching between coding conventions between my projects and the languages that I use. You should ensure that your projects will use a well defined naming convention, so you can introduce more easily new developers in your team.


community

Is nice to see that most developers agree with the idea of having open communities rather than close ones. That allows permanent contributions to the language development, allowing the creation of user groups, mailing lists and help forums. That increases the language usage as much as I know. As examples of large communities you have the PHP community, with only disadvantage of allowing multiple standards on code indentation and naming conventions, making PHP programming less attractive than other languages.

Preferred Community

Preferred Community

Finally, I agree with the idea of having an open community with clear rules, rather than complete freedom. This ensures certain quality standards around the language and the people that participates on the development process.


language of choice

Finally, the language that most people prefers — at least on those that have answered the poll — is Python, among other options like Java and Ruby. So, it seems to consistent with previous answers on the poll. Also seems that PHP is loosing its popularity between developers, because it had less than 10% as preferred language. So, most people is preferring Python, Java and Ruby, very close to the 20%.

Language of Choice

Language of Choice

So, I can conclude an ideal language should be like Python on its indentation strictness and syntax sugar, but using camelCase and having a community like PHP, running over a virtual machine that allows native compilation. The closest language that I know running under those conditions is Jython, which is Python running over the JVM and JRuby on the Ruby side, where both have a dynamic type system — which is treated as static type system in background. I hope that you will enjoy the poll results as me.


3 comments to “the language of choice”

  1. “I prefer static typing and strong static typing, because they allow me to introduce less bugs than dynamic typing.”

    Check this for a perspective about why dynamic typing is not so dangerous:

    http://www.johndcook.com/blog/2010/06/09/dynamic-typing-and-risk-homeostasis/

  2. Thank you for your response Alejandro. A very interesting approach from John D. Cook. But if you see some examples in Haskell, which has a strong static-typing system, it has a very well designed property based testing library, which is widely used. I just meant that static-typing provides a safer way to check input data, among other tasks like deriving combinators properly using types instead of if/then and case sentences. In any case, I do not wanted to mark a purist preference, as I have said in past posts, everything depends on the usage ;)

  3. I’m no C++ guru, but I’m pretty sure you can’t create new operators in C++ (which I think is what you claimed).

post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>