There is no ideal: how I looked for a programming language for myself
From a translator: This post is a slightly abbreviated translation of the original article by Gal Schlesinger, an experienced frontend developer. He really likes programming, and his hobby is studying various (and sometimes very unexpected) programming languages for both work purposes and for his own pet-projects. Gal also talks about the advantages and disadvantages of several of them in this material.
Despite the fact that at work I most often work with Java, JS and Ruby, I like to learn new languages and frameworks. It seems to me that continuous training helps to form interesting new ideas that can be used, if necessary, to solve a specific problem. In addition, functional programming helps to understand more about object-oriented programming, and constant work with Rails allows you to learn many of the nuances of testing (of course, if you practice). The problem is that sooner or later, in the process of learning other languages, you begin to wonder: is there an ideal among them, where all the useful functions you found in others would be collected?
Skillbox recommends: Practical course "Mobile Developer PRO" .
We remind you: for all readers of “Habr” - a discount of 10,000 rubles when registering for any Skillbox course using the “Habr” promo code.
I want to add: my preferences in programming languages may not match yours. In this article I describe my experience gained over the past couple of months in the course of working on major projects and those that I create in my free time.
I started to learn Ruby only because his community constantly repeats the idea that everything here is different from Java, with which I worked earlier. I really like Ruby. This is a great language with a large number of ready-made libraries (we call them gems, gems), which allows you to quickly develop and put into use a new application. Rails - what can be called "sat down and went."
Ruby is an object-oriented language, so that all the code will be in approximately the same style, no matter which library you decide to choose. The community here is very powerful: programmers prefer to modify existing libraries instead of creating a new one each time (ActiveRecord and Sequel as an example). This feature allows you to make your life easier.
True, Ruby is not fast enough when it comes to performance. Components are usually “heavy” and take a long time to load. Practicing with Rails is fun, but running applications means spending time and money. Heroku and AWS ECS are examples of this: you'll have to pay for RAM, file space, traffic, and uptime. In addition, it should be borne in mind that the estimated start time for an average-sized application is 5-10 seconds.
JS has a lot of flaws. One of the main ones is the division of the community into various areas of language development in accordance with its preferences. So, the main differentiation is around type systems (Flow vs. TS), and approaches to using libraries and everything else differ. As a result, many developments, the modules are simply "raw".
After working with the previous two languages, I started learning Swift. I needed the language to advance in my "game of the developer." Initially, I was at level zero, because I only knew how to create applications with Native React. In principle, that was enough, but I wanted to learn more.
Swift is a statically typed language. Initially, it was created to develop applications in the Apple ecosystem, but then it became open-source, so they now work with it to create applications for Linux. The advantages of the language are that applications written in it load quickly, and the compilation process is clear, so that the number of runtime errors is gradually minimized.
The syntax of the language is interesting and not too difficult to learn, some functions help to avoid errors and problems. For example, if part of the code “expects” a string, erroneous transmission of an integer there is not allowed. This allows you to catch and correct errors at the earliest stage of the development process.
Why is Swift not my hero? The fact is that it is not so easy to write in Swift in editors other than Xcode. I usually use Vim, other editors are slower. Somehow I tried VSCode and Atom, but I didn’t really like them. Perhaps in the end I will focus on the Swift CLI, which will allow you to create plugins for the editor, but not now. Swift also does not have static compilation, so to use the CLI you will need to configure your environment with Swift. This is normal for Mac applications, but the servers are Linux.
I am very pleased with this new syntax and toolkit for Ocaml developed by Facebook. The tulkit is quite mature, it gives a lot of functions. Good ones are OPAM, the package manager, as well as Merlin and OCaml / Reason. All this works well with Vim. And even if you do not mention the autocomplete engine and other functions. The developer tools here are very good.
Reason can be compiled in JS using BuckleScript, which generates executable JS from Reason / OCaml code. This is amazing, because in this case we get fully typed systems with excellent JS interaction, and we can also use the necessary libraries.
The only thing I don't like is that I have to create many type definitions just for dependency use. But this is nothing, because we do not need to assemble the entire module, but only the input / output of the specific function / class / method that we use. All this works very quickly and without problems.
The difficulty in creating a native Reason application turned out to be the use of some libraries. This is primarily OCaml, but since OCaml and Reason are interchangeable, I used the Chrome extension to work with Reason code. The problem turned out to be that there is an OCaml code that cannot be converted to Reason, possibly due to a lack of PPX in the Chrome extension. PPX, as I understand it, a syntax extension is a macro that converts code. This is a bit of a Babel plugin.
By the way, Reason / Ocaml does not support multi-core, there is Lwt for this. But for this library there are still no intelligible manuals!
The entry threshold for OCaml / Reason is very high, which is a little frustrating. The community is not too developed, and few people explain strange things well. Perhaps this will change over time.
Just a fantastic language. It is easy to learn, the code compiles and runs without problems. There is support for multi-core systems and many other useful features. The community is quite developed, with a large number of specialists.
The fact that there are many powerful modules and applications written in Go, such as Docker, Kubernetes, CockroachDB, means that you can create an infrastructure binary for, for example, Raspberry pi inside your application.
The lack of generics (which can be added in one of the next versions) is strange because there are "structural" difficulties when using graphs, trees, and algorithms. I would prefer the compiler to do everything for me.
In addition, the problem for me is not very clear modular VGO system. Over time, we will learn more about it, as the community is gradually developing, but so far there is little information. The language itself is quite complex. This is not a reason not to use it, but for now I am avoiding full-time work with Golang. He is, so to speak, boring. Perhaps in the course of time I will reconsider my views.
We started with Ruby, so I suggest finishing Crystal.
This is one of the new languages, still not getting to version 1.0, which looks almost like Ruby, but it is statically typed and fast! It offers developers a large number of functions, including optional types, CSP and much more. There are a couple of new Crystal web frameworks like Lucky and Amber. There is Kemal, which is like Sinatra, but for Crystal, plus there are ORMs.
But, since the language is still young, it is not quite ready for active use. For example, I would like Crystal to use all the cores, like Go. An editor with autocomplete and hints of types during hover would also not be superfluous. I'm a little worried about the idea that Crystal might not get to version 1.0. I sincerely hope that he succeeds.
What is your favorite programming language and why?