Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save knocte/7b9435ba4a75add0bef8cfc15c1006c5 to your computer and use it in GitHub Desktop.

Select an option

Save knocte/7b9435ba4a75add0bef8cfc15c1006c5 to your computer and use it in GitHub Desktop.
Rescued answer from stackexchange (which was deleted because the question was deleted....)
I'm a hater of the sentence "use the right tool for the job". Nowadays, any language can do pretty much anything you want to
do with it (except if the language has recently been created and is still in the early stages, i.e.: Rust).
So then IMO these days what you have to do to choose your programming language is not ask what you're going to do, but know
what you want to avoid.
So I use this rule of thumb:
* Do I want to avoid paying licenses (or resorting to piracy if I'm in the early days of a startup and I don't want to spend
money), then I choose a language and a set of tools which have open source implementations (compiler and class libraries)
(i.e.: C++11 vs MS Managed C++)
* Do I want to avoid chasing memory leaks for the rest of my life? Yes, therefore I use a language which has garbage
collection (i.e. Java vs C).
* Do I want to avoid painful evolution of my project, especially when it's getting larger (wrt easy refactoring and
maintainability)? Then I use a statically typed language instead of a dynamically typed one (i.e. TypeScript vs JavaScript).
* Do I want to avoid recent headaches I've had with other software projects in which concurrency was very hard (read:
race conditions), then I choose a functional language (to achieve immutability, avoid side-effects, etc.) (i.e: F# vs C#).
And it's not that I ran out of questions, there are many more...
But, did you guess it? The questions above are the most important ones you should ask yourself when choosing the next
language to use/learn, in my opinion. And, did you guess it? This is why my current favorite programming language is F#:
because you can avoid most of the pitfalls that you find in other programming languages in the industry, and you still
can do pretty much anything with it.
There are other new languages out there that are gaining traction (or old ones that still kick ass like Haskell),
but I still don't consider them stronger than F#. If you're interested in knowing why, I have more details here:
* Rust: already mentioned it's maybe too early to use. I like how safe and statically typed it tries to be, but there's no
way (yet) to write a truly-crossplatform (mobile & desktop) app, and it doesn't have yet async syntactic sugar.
* Go: definitely a language that is giving a lot to talk about. The only thing I don't like about it is that, even though
it uses an error-passing model that might be better (not sure yet) than the try-catch model, it makes errors not bubble up
(thus ignored) by default, which doesn't look very safe to me. Plus it doesn't support generics (yet?).
* Haskell: a very good contender in the functional-paradigm world, however the fact that it doesn't interoperate with other
languages at the VM level (like F# or Clojure) and the tooling is a bit immature (can you develop an iOS app in haskell and
debug it with any IDE?)
* Scala: a good static-typing alternative to Java, a bit less verbose, hybrid between functional and object-oriented paradigm,
and which runs on the JVM. Disadvantages I see: doesn't default to immutability, like most functional languages do, it has
problems with tailcalls in some cases, and it doesn't do tailcalls by default (you have to explicitly mark them as such). Also
see the next bullet about JVM downsides.
* Clojure: another good alternative to Scala if you're really convinced about immutability and the functional paradigm,
because it also runs in the JVM. Only disadvantages I see are:
** JVM itself, a virtual-machine whose opensource counterpart is much worse than Oracle's version.
** JVM design is less efficient than .NET because its bytecode doesn't support generics (they're supported at the language
level, which means that there's casting&boxing at runtime).
** JVM doesn't seem to do tail call optimizations (a fundamental technique for functional programming) as well as other
VMs (i.e.: .NET).
** It has a dynamically typed system (although there's optional static typing via a library!:
http://logaan.github.io/clojure/core.typed/2013/08/29/first-look-at-core.typed.html?utm_source=dlvr.it&utm_medium=twitter ,
but almost nobody uses it).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment