📜 ⬆️ ⬇️

Why learn unpopular languages. Community example F #



There are cult films, games, books or music - they are terribly fond of a cohesive community, professionals and critics. But there is no commercial success and wide popularity. I am in such situations usually painfully insulting.

In the development of good technology is also not always becoming massive. For example, F #. All I know about him is a wildly cool, but completely unpopular language, after which the developers can no longer simply return to their usual languages.
')
I tried to find out the reason. And in general - who are the people who write on it, and why do they do it if the business does not need the language? To do this, I knocked to speak in the Russian-speaking community F # in the Telegram. Here is our round table.

How to start learning F #


Ayrat Hudaygulov ( Szer ): I myself come from C #. We had work related to Akka.NET, which was ported from Akka to Scala. The port is excellent, but there were no examples for rare documentation cases, they were always in the Scala-dock. When I read this dock, some questions came to my head - why in Scala everything is written in a couple of lines, and I suffer from C #?

The output was found - F #. Since then, and not tears.

Roman Lyman ( kagetoki ): It turned out to be a powerful tool for solving very real everyday problems of any programmer. The difficulties that were considered the norm and inevitability in the OO world of C # and Java are not inevitable at all, and they can be easily prevented instead of overcoming.

Phil Ranzhin ( fillpackart ): Somehow on Habré I read a great interview with Vagif Abilov. At that time, I did not understand the functional programming paradigm at all, and any information about it seriously irritated me. So is the interview.

Vagif Abilov ( VagifAbilov ): That material can be read here . This was shortly after my speech at the Moscow DotNext conference. In a nutshell, I began to study F # from the desire to write more compact code (less code - less evil) and work with immutable data structures. Of course, no one bothers a C # or Java programmer to define their data structures as immutable, but the basis of languages ​​implementing OOP is the possibility of mutations of data structures, and this possibility will not leave these languages ​​anywhere. Functional programming allows you not to waste efforts to protect data from incorrect changes in a multi-threaded environment - the data will take care of themselves, they are immutable.

Phil Ranzhin : Vagif kept saying that after ceremonial C # and Java, F # seemed like something much more suitable for development. I did not know then who Vagif was, but, of course, I immediately decided for myself that he did not understand anything. C # is not ceremonial, C # is exactly as it should be. Powerful and beautiful. I decided to write an article about how functional programming is ridiculous. I took a simple task, and started implementing it in C # and F # to illustrate my point. F # in the process I went so much that I did not begin to finish the article. I began to study this technology.

Roman Lyman : Many things that are checked in C # at runtime have now migrated to compile-time, so that the sensations seemed to have tried static typing for the first time - a revelation came down straight.

Where in F # you need seven lines of code, in C # the equivalent code will unfold to 200-300, without exaggeration (and this is only a useful code). The compiler itself generates a bunch of boilerplate for you, for example, structural equality.

Phil Ranzhin : I have never debugged the F # code, because in my F # code, all the bugs are caught at compile time. I am not kidding.

Is it hard to learn F #


Roman Lyman : How hard is it to study? For me it's not hard at all. The only thing that starts at the beginning is tough if you first come across a functional paradigm and immutable types. But this problem is not a change of language, but a change of paradigm.

The syntax is not obvious at first, so bravado is better left aside and read about the language, and not hope that the knowledge of C # is enough with the head.

Ayrat Hudaygulov : F # supports everything that exists in C # except goto (it is completely expression-based language, it would be strange to make an imperative transition in the calculated expression) and the protected keyword (this is by design, since it is obviously not difficult to make it). Everything else, our favorite OOP - abstract classes, interfaces, auto properties, usings, and trai-ketches - of course. For lovers of counting bytes, too, everything is there: ref / out parameters, mutability, spans, unmanaged, pointers, stackalloc.

All features in C # come with a lag of a couple of years compared to F # (generics, async / await + task, LINQ, pattern matching, and more). And many features generally doubt that they will ever stop by (sum types in the person of discriminated unions, native function currying). Fresh C # 8.0 promises to bring records and recursive pattern matching. Attention question - why wait?

And another question: why learn a new language to write on it in the same way? To get the benefits that gives F #, but does not give C #, you have to understand the other side of the Force. And it is not easy.

John Doe : How C # developer is grateful to the creators of F # for generics and asynchrony with a human face in C #. If anyone knows, these mega-fiches have appeared in C # thanks to F #.

Vagif Abilov : In the well-known book "Pragmatic Programmer" developers are advised every year to learn a new programming language. I can not boast that I follow this advice exactly, but the main thing, in my opinion, that the authors wanted to tell them - the programmer must constantly be ready to revise the principles of writing their programs.

Many in general are too worn with programming languages, as a life credo. If you switched from Java to Clojure, sometimes they will react as if a Christian converted to Islam. Why, actually, such attention? Learning new programming languages ​​often allows us to rethink our habits of working with old languages. Those who are familiar with F # write differently to C #.

Roman Melnikov ( neftedollar ): In F # OOP is more correct (although fully compatible with OOP in C #) because pushes programming on abstractions-interfaces, instead of explicit classes.

What do they think about the creators of the language


Nikolai Matyushin : Once I contributed to the support of the type providers on the .NET Core. For a long time, they did not work, and we with one person from the Russian-speaking community decided to figure out what the trouble was. They checked, saw that in .NET Core there is no function that saves the assembly (object) to a file - this function was used by the providers.

We spent one or two weeks on the prototype that did it. It turned out a terrible crutch, but partially working. All this time they talked to an issue on a githaba, and then Don Sime came, wrote “Few hours of work”, and repaired the type providers.

Vagif Abilov : The creator of the language, Don Syme, is accessible and democratic. I hope he will reach some Russian conference so that Russian developers can get to know him personally.

Roman Lyman : Syme is a genius. Amazingly, he created all this beauty almost alone.

Pavel Smirnov : He is my programmer idol.

Ayrat Hudaygulov : Don Syme, by the way, put the generics in .NET, otherwise we would sit in C # and hardcore everything from the object and back, as it was (and in part) in Java. Sym develops the language with an eye on C #, for compatibility with its new features, which is probably strategically correct. But this means that the echo of bad decisions in C # can also get into F #. He also opposes the introduction of "abstruse" OP-features (hello Scala), and the over-addition of the language, since they can scare other people and inflate the standard libu (hello C ++).

I think Syme is a hero. I agree with his vision of the language as multi-paradigm, but I would have thrown something into the language from above.

Why language is not popular


Roman Lyman : The language is not popular, in my opinion, because in general, OP is less popular than OOP. Plus, there is a threshold of entry. And then - trick 22. Projects on F # do not write, because there are few programmers on the market, and programmers do not learn this language, because there are no projects on the market.

Phil Ranzhin : I do not know people who would practice functional programming, but would prefer object-oriented. Here F # is especially unlucky - it is only suitable for those who believe in the symbiosis of these paradigms.

Pavel Smirnov : Many considered him stillborn because of Microsoft's policy - F # was just a platform for playing with features for C #. But the language was initially positioned more for data science than for industrial development.

Roman Melnikov : Resharper. For C #, this is an important topic, and many have already spent it. Without Resharper on C # to write sickly, you need to prescribe a lot of pens, such as highlighting allocations. And resharper removes a bunch of pain sisharperov. In F #, there is no such pain, but those who have a resharper cannot appreciate all the delights of a language that does not rely on tulling.

Vagif Abilov : In my opinion, the reason for lagging behind the success of Scala lies in the dominance of Microsoft, which still determines what is a priority on the Windows platform. Given that F # was developed by Microsoft Research, it was always positioned by the company as a language for enthusiasts. Microsoft has metrics showing the economic viability of developing a technology depending on current sales, and of course, some SharePoint according to these metrics looks more attractive than F #. But a drop wears away a stone.

Phil Ranzhin : I believe that he will shoot. All the power of .NET paired with the most modern syntax and the most idiomatic approach in history can not help but shoot.

Roman Melnikov : Prospects are awesome. F # gradually enters data analysis, thanks to type providers, for example. There are compilers in js and the elmish magic library (essentially Elm for .NET).

Miguel De Icaza actively supports F #, and in Xamarin his support was always the same as in C #. There is a compiler in ErlangCore, which is also wildly cool. On F #, you can write a completely backend and frontend. SAFE-Stack is a freaky thing, with typed api calls, cool wrappers over web sockets (Elmish.Bridge), and a whole bunch more.

Vagif Abilov : I am very pleased that I manage to use F #. I work in a Norwegian broadcasting project, our system downloads TV and radio media files to the cloud to make them available for viewing and listening from computers and mobile devices. The system is written in F # and uses Akka.NET. This is not the only project in our organization where F # is used, and what is especially encouraging is that the number of such projects is growing, as is the number of developers who are ready to switch to this language.

What is F # suitable for


Phil Ranzhin : F # fits perfectly on the development of AI. This language is literally made to abstract me from the complexities and focus on the main thing. When you do an AI, your task is to apply your mindset to the behavior of the machine. In such cases, code is your intermediate language, which is not able to express things that are too complicated. Here F # is able to be so abstract that it would not interfere with you and your car to create history.

Vagif Abilov : It is applicable to any tasks, but it is particularly good for domain modeling tasks. In last year's interview on Habré, I imprudently said that functional languages ​​are more applicable to algorithms and backends, and less so to programming user interfaces and web pages.

Somebody noticed to me in the comments then that there is such a functional language Elm, which is specially written for programming web pages. The commentator was absolutely right. I have since started using Fable, which allows you to write web applications on F #, compiling them into JavaScript. Awesome impressions, the F # + Fable combination (and also the Fable-Elmish library) open up access to web programming for developers who do not understand anything in CSS like me.

Pavel Sirnov : Data driven development is a concise FP language that supports Type Providers. Actor model - MailboxProcessor in the standard library is a fairy tale.

Roman Melnikov : Perfectly solves web problems, integrates with react-components . The tasks of data analysis and machine learning ( fslab.org ), ETL tasks, business logic design problems are solved - the type system allows writing so that there are no wrong states.
The tasks of parsing are solved tremendously (Fparsec). Great for writing your own languages. The same TypeScript was originally written in F #. Written code for the GPU .
I myself write fsx scripts on it instead of bash and python for my machine.

Yes, under the microcontrollers on it can not help. But I think enough people can do without it.

Where to get information


Books



the Internet



Telegram



A few words about the community


Roman Lyman : The community is cool, everyone has the desire to write on F # for money, so all newcomers are greatly helped to increase the community, increasing the chances of finding a job.

Phil Ranzhin : Dangerous sectarians. But they are right.

Pavel Smirnov : The Russian-speaking community F # is a very cozy place. Most of all I like the fact that they are not indifferent to their language, as well as it happens in other more well-known ecosystems.

Nikolai Matyushin : Maybe due to the fact that the language is not very popular, and toxic people do not linger.

Roman Melnikov : There are their own dramas do not affect the language. But life is made more interesting.

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


All Articles