The Best Programming Language
I’ve been to a family party once. My sister invited some of her friends over. I knew that two of them were seasoned software developers with strong math background, working in cool companies and having some well paid side projects. Naturally I didn’t want to get into technical discussions because others around the table were not into programming at all. Being a nerd as I am, and not finding any topic to continue the conversation I asked: “what’s your favourite programming language?”. I thought I would get a fairly short answer and we move on to other things to discuss. At that time I recently learned Scala and discovered Functional Programming (FP). I was very excited about it. I could see better new ways of doing things and in a way was curious if these guys, who were maybe 20 years older than me, were also into FP. I thought they might not know Scala, since it’s fairly new and at their age and status there is not enough time to keep chasing every new technology. What happened next somewhat unpleasantly surprised me - they just laughed. I don’t remember if they followed up their laughter with a short explanation, but their message was clear to me: it all depends on a task at hand and some languages fit better than others for a specific task.
This stayed with me for many years up until now. Every time I think about a perfect programming language I remember that scene. That time I just kind of ignored their reaction and moved on with other topics to discuss, but being open minded and trying to understand where these guys coming from I kept thinking about it. I kept checking and challenging my own idealistic views.
You see, when you learn FP you feel like you’ve found an island of purity. You now know how to make your programms safe and reliable. You use a strong static type system: your program is the proof of correctness. You don’t need to write lots of code to get things done. Your code is more smart, elegant and you feel like you’ve reached the next level. What I expected from these guys as a reply, or maybe what I intended to say was how cool FP really was. I knew that, obviously, there are languages that work better in certain domains, but as a default I would prefer writing in FP style because it’s so much better.
Back to 2017 now. I’ve gone through many languages be it OOP, FP, mixture of both, dynamically or statically typed. Every time I’ve learned a new language, I would compare it to some golden standard I have in my mind and try to assess where it’s niche was. What does it let you do easier than other languages.
Now that I’ve moved from enterprise and web software more into machine learning, I work with Python a lot. Python is a modern language with OOP and FP capabilities, but doesn’t excel in either. It has dynamic type system which to me means that I never know if my code works until I run it. What’s great about Python that it’s easy to get stuff done and machine learning/data science ecosystem is the strongest at the moment. The points Python loses in solid code development features it more than makes up with its simplicity, flexibility and ecosystem.
So what’s the best language in my opinion? Does it even make sense to try define one? Can a single multiparadigm language be better than all other languages? As software developers, we usually want to know the best way to do things, we want to learn that one language that can do it all. At least, in my a bit idealistic mind, I want to know a few best languages - one for each domain.
I’m inclined to think these days that there is no single best language, but we can get fairly close to perfect within a domain, be it systems programming, mobile, web, ML, etc. if we take everything we know and agree to follow certain practices and styles. Given that, our ideal language won’t still be perfect in a practical sense because you can’t have static and dynamic types combined together, you can’t have strong type system with metaprogramming and higher kinded types and have beginners deal with them. Maybe we could have all that if we have a modular language. I’ll get to this point later. Yet, would you optimize your language for performance or elegance, safety or convenience? These tradeoffs are very hard to unify. One of the criticisms of Scala is that it tries to keep all of these options open, which leads to too many ways of solving a problem and too many styles of code. Although, Scala, I believe, shows the preferred path.
What’s interesting about Scala that it took an agile and ubiquitous approach to language development. Versions were rolling out one after another and features were added quickly, whilst Java - it’s older cousin - didn’t seem to be able to deliver single next version (8). Languages should be more experimental, like Scala, so that we arrive at best language features faster or learn what doesn’t work. Now scala compiles to native code, Java Script and Java byte code. It has its hand deep in the big data space with Apache Spark and its successors. It has, perhaps, the richest array of concurrency options and libraries available out there.
Why not Scala then? Why Scala can’t be that one solution for all? At least there are practical reasons. You can’t move over all machine learning developers and data scientists from Python, especially, if the ecosystem is not there yet. They prefer to deal with complexity in their algorithms and not in the language. JVM garbage collection and GC pauses are not for everyone, although GC fits most cases. Low level memory access and native code is not production ready (Scala native). No matter that the language is quite cool and in many cases is the best choice, it’s not going to take over the world just yet. Then again, there are even more strict languages in FP like Haskell and the likes.
There is some remote hope for Scala’s world domination though. Scala creator Martin Odersky suggested to define multiple levels of Scala features: from basic to advanced. This could be an interesting approach to making the same multi-paradigm language work in different domains. The fear is whether this would look like multiple languages in one. There is still active research in language design and FP community to find better abstractions and ways to do things and unify what’s already there.
As for me, I’ll keep an eye on FP because that’s the future. I’ll try to do generic things in Scala or similar languages. When it comes to machine learning I’ll take advantage of Python ecosystem and not going to fight it. Who knows, maybe Julia will steal the show from Python in ML category later on. In all other cases, I’ll just use language that helps me do my task in the fastest way possible, if time is on the line, otherwise, and by default, I’ll choose tools that help me achieve the highest quality. Anyhow, there are too many bad software products in existence already and it’s better not to add to the mess by making another shitty product. The more your language restricts you, the more power you gain, that’s why I like FP and static types.