📜 ⬆️ ⬇️

There is no ideal: as I was looking for a programming language for myself



From the translator: this post is a somewhat abridged translation of the original article by Gal Schlesinger, an experienced frontend developer. He likes programming a lot, and his hobby is studying various (and sometimes quite unexpected) programming languages ​​both for work purposes and for his own pet projects. Gal also tells about 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 learning helps to form new interesting ideas that can be used if necessary to solve a specific task. In addition, functional programming helps to understand more about object-oriented programming, and the 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 think: is there any ideal among them, where all the useful functions you found in others would be collected?

Skillbox recommends: Practical course "Mobile Developer PRO" .
We remind: for all readers of "Habr" - a discount of 10,000 rubles when recording for any Skillbox course on the promotional code "Habr".

I want to add: my preferences in programming languages ​​may not coincide with 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.
')

Ruby


I began to study 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 lot of ready-made libraries (we call them “gems”, gems), which allows you to quickly develop and use a new application. Rails - what can be called "sat down and went."

Ruby is an object-oriented language, so all the code will be about the same style, no matter which library you choose to choose. The community here is very powerful: programmers prefer to modify existing libraries instead of creating a new one for themselves (ActiveRecord and Sequel as an example). This feature allows great ease your life.

True, Ruby is not fast enough if we are talking about performance. Components are usually “heavy” and load long enough. Practicing with Rails is fun, but running applications means spending time and money. An example is Heroku and AWS ECS: you have to pay for RAM, file space, traffic, and uptime. In addition, it is necessary to take into account that the estimated starting time of an application of medium size is 5-10 seconds.

Javascript


I love javascript. Most of my frontend projects are for the web, as any person now has access to the browser. This is a relatively easy-to-learn language, it is very common, the entry threshold is low. Developer tools are quite good, implementing prototyping using JavaScript is just a dream. There are also many participants in the community who pay a lot of attention to the improvement of components.

JS has a lot of flaws. One of the main ones is the division of the community into different directions of language development in accordance with their preferences. So, the main differentiation goes around type systems (Flow vs. TS), and approaches to the use of libraries and everything else differ. As a result, many developments, the modules are just "raw."

Swift


After working with the previous two languages, I began to learn Swift. I needed the language for advancement in my “developer game”. Initially, I was at zero level, because I only knew how to create applications with Native React. In principle, this 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, thanks to which they are now working with it to create applications for Linux. The advantages of the language are that applications written on it load quickly, and the compilation process is understandable, so that the number of runtime errors is gradually reduced to a minimum.

The syntax of the language is interesting and not too complicated to learn; some functions help to avoid errors and problems. For example, if a part of the code “expects” a string, an erroneous transfer of the whole number there is not allowed. This allows you to catch and correct errors at an early stage of the development process.

Why is Swift not my hero? The fact is that it is not so easy to write on Swift in editors other than Xcode. I usually use Vim, other editors are slower. I once tried VSCode and Atom, but I didn't like them very much. Maybe I’ll end up on the Swift CLI, which will allow you to create plugins for the editor, but not now. Swift also does not have a static compilation, so to use the CLI you will need to set up an environment with Swift. This is normal for Mac applications, but servers are Linux.

ReasonML


I am very pleased with this new syntax and set of tools for Ocaml, developed by Facebook. Tulkit is quite mature, it gives a lot of functions. OPAM, the package manager, and Merlin and OCaml / Reason are good here. It all works great with Vim. And that is even if not to mention the autocomplete engine and other functions. Developer tools are very good here.

Reason can be compiled into JS using BuckleScript, which generates the executable JS from Reason / OCaml code. This is awesome, 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 to use dependencies. But this is nothing, because we do not need to assemble the entire module, but only the input / output of a specific function / class / method that we use. It works all very quickly and without problems.


For me, the difficulty in creating a native Reason-application was 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 was that there is an OCaml code that is not converted to Reason, possibly due to the lack of PPX in the Chrome extension. PPX, as I understand it, the syntax extension is a macro that converts the code. This is something like the Babel plugin.

By the way, Reason / Ocaml does not support multi-core, for this there is Lwt. But for this library there are still no intelligible manuals!

The OCaml / Reason entry threshold is very high, which is a bit frustrating. The community is not very developed, and very few people explain things that are not well understood. Perhaps this will change over time.

Golang


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 absence of generics (which can be added in one of the subsequent versions) is odd, since there are “structural” difficulties in 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 system VGO. Over time, we will learn more about it, as the community develops gradually, but so far there is little information. The language itself is quite complicated. This is not a reason not to use it, but so far I have avoided working with Golang. He, so to speak, is boring. Perhaps over time I will reconsider my views.

Crystal


We started with Ruby, so I suggest we finish Crystal.

This is one of the new languages ​​that has not yet reached 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 more. There are a couple of new web frameworks for Crystal, such as Lucky and Amber. There are 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. I would like for example Crystal to use all the kernels, like Go. An editor with autofill and type hints on hover would not be superfluous either. I'm a little worried about the idea that Crystal might not get to version 1.0. I sincerely hope that he will succeed.

What is your favorite programming language and why?

Skillbox recommends:

Source: https://habr.com/ru/post/424591/


All Articles