My Opinion On Various Programming Languages

Tags: Technology

Here are my opinions on various programming languages. I don’t think I have too many controversial opinions in this respect. Even still, I hope at least a few of my takes are mildly triggering. At the end of the day use the right tool for the job.

I think Bjarne Stroustrup said it best. “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”

C

Still unrivaled in embedded development. And I think there is a nice simplicity to it. There are newer languages though, many of which have useful features.

C++

I personally prefer the extra features C++ provides over C. Having objects, and a larger standard library is nice. I also appreciate the C++ committee’s dedication to keeping things performant (zero overhead principle).

In terms of performance and ease of use there is really nothing that matches C++. C lacks a lot of basic features we enjoy as modern developers, and Rust is quite difficult to learn.

C++ also has multiple excellent compilers. Nowadays, most programming languages have a definitive implementation, which is great as your code always runs the same. It also locks us in though. Should a major company stop supporting a compiler (or start making poor decisions for the community), it could leave us high and dry. Luckily, we haven’t seen this yet.

Blemishes of C++

I really want to love C++ more, as the core language is really nice in my opinion. But there are just too many things that make it too difficult to use.

No Build System

First and foremost is the lack of a dedicated build system. Essentially every project uses a different build process and it is difficult to combine them.

The best option seems to be header only libraries. But they have many drawbacks, particularly in build times, and in the quirks that come with writing code exclusively in header files.

Then there are just a bunch of other build systems and way to link things. CMake is okay, but I find that anytime I want to include a library that isn’t header only, it is quite difficult.

Keep in mind that I am not advocating for a centralized repository from which to get code. I’m rather impartial towards that. I’m talking just a build system like cargo, maven, or Go s build system. A standard way to include and compile libraries so you don’t have to “write it yourself”.

Compilers/Cross Platform Support

I will say I don’t think this is as big of an issue as it has been in the past. As long as you are using the native compiler for your system you hopefully shouldn’t run into too many problems. Even still the compilers are just different enough to cause you some grief.

For the new coder it can be very easy to include system-dependent headers as well. And these will make cross compilation not work.

Luckily the standard library has advanced to a point where you can mostly avoid system dependent headers.

Memory Management

As much as I would like to say that one should just not write memory bugs, time and time again we have seen this just isn’t possible. In fact, buffer overflows due to bad memory management is one of the single biggest causes of security vulnerabilities that exists.

Of course, you can just use smart pointers and standard library containers to nearly completely overcome C++ s memory management issues. But that is not an easy solution to patch on. It is often non-trivial to integrate memory safe code with legacy code using manual pointers.

Any security critical code should now be written in Rust.

To conclude this long section, I would once again like quote Bjarne Stroustrup: “Within C++, there is a much smaller and cleaner language struggling to get out”. I fully agree with this quote. If you are disciplined it is an amazing language. Unfortunately, it has just a few too many inconveniences and foot-guns for me to use in my personal projects.

Java

To be perfectly honest, I was surprised at how nice it was to code in Java. Java has a huge reputation for being a purely object-oriented language. And while it does deserve that title as it is the most object-oriented language I know, I was surprised to see how good its functional support was. I would argue it has some of the best functional style support on the market.

Of course, saying what is functional versus what is object-oriented is a whole discussion in itself. So, for this article I will say there are just two things that come to mind. First algebraic data types, and second, first class functions (largely through lambdas).

Java just felt nice. There were lots of great features, but it didn’t feel bloated, and it wasn’t as easy to shoot yourself in the foot with legacy features.

Of course, it also isn’t a perfect language. While Maven, and dependency integration in general is leaps and bounds beyond C++, it still isn’t as simple to use as more modern build systems. (Though perhaps it should be said that maven probably gives you more versatility in your build process than some modern build systems.)

Java is also a memory hog. The JVM is one of the most amazing pieces of software we have today. It interprets bytecode faster than any other system by quite a large margin (with the help of the JIT compiler). But in doing so the tradeoff was made to prefer speed over memory consumption in many cases.

The dependency on the JVM is a blessing and a curse. It is amazing for cross-platform development, but it also adds an extra step to distributing programs. This may seem rather trivial, but for me, I like being able to just distribute an exe file. That isn’t possible for Java. Your users must either be technical enough to know how to run a Java program from the command line, or you must provide them with a bash script that does it for them. Even if their system is automatically set up to run .jar files, it just isn’t as reliable as a good old exe. I also recognize GraalVM exists for compilation to exe, but that's not the preferred way to run Java, and you also lose out on the benefits of the JIT compiler.

Go

I like Go a lot. It's honestly a really fresh breath of simplicity. Taking the simplicity of C, strapping a garbage collector to it with a few other quality of life features worked out really well.

Its performance is pretty similar to Java (depending on workload), but it compiles to a static exe. It also uses significantly less memory than Java. I’m also a fan of the interface system.

You also can’t mention Go without its state of the art concurrency system. Concurrent programming is easier in Go than any other language, no questions asked (we’re not talking about esolangs).

Go is the language to choose when you just want to get crap done, which in my opinion makes it a particularly strong hobby language.

Unfortunately, there are two things that keep Go from being the perfect language for me. First library support is a little light in places. There aren’t any amazing GUI libraries for Go. Secondly it doesn’t have algebraic data types.

There is a lot of discussion around what features should be included in Go. As programmers, we usually want more features. But the Go community (with good reason) is extremely cautious about adding anything to the language for fear of ruining its simplicity. This is probably for the better to be honest. But I think proper enums/algebraic data types would go a long way in helping programmers write correct code without uncomfortable workarounds.

But as I’ve said, much care should be taken. I personally did not like the implementation of iterators in Go at all. I think they shouldn’t have been included. And if people really wanted it a simple iterator interface with two functions would have been sufficient while keeping to Go’s core philosophy of simplicity.

Rust

Rust is the ugly child that I have to be proud of because they are so smart. It has taken me a long time to get at least somewhat comfortable with Rust, and I still can’t decide how much I like it.

Rust has a lot of things going against it for me. In particular, its verbosity and its difficult memory model.

Let me start with its verbosity. I don’t necessarily hate its verbosity as much as I hate how long it takes to write anything. Being verbose is good as you tell you are telling the computer exactly what you want it to do. Unfortunately, any time I write Rust (even with features I’m comfortable using) it feels like it just takes forever and that writing the same thing in C++ would go so much faster.

Then there is borrow checker. The borrow checker is what makes rust so powerful. Frankly it gives rust more strengths than weaknesses. But should you need to write a data structure that isn’t trivial, things get really hard really quick. I have yet to write much async code in rust as well, and apparently that is really difficult as well.

But provided you can overcome those two quite large obstacles, rust has so many benefits that are just too good to pass up.

First it is the only mainstream language that is as fast as C/C++ with a proper dependency management and build system. And it does so with memory and thread safety. (While garbage collected languages are memory safe, there are basically no other languages that advertise thread safety as well)

Rust’s Algebraic types are exquisite and make writing correct and safe code heavenly.

And just in general there is a ton of support behind rust right now. Even though few libraries have hit v1, there is a boatload of work being done to make that happen. In fact, many libraries are already quite stable and suitable for production purposes.

I also wanted to mention Rust s const-correctness. This is something that I’ve really only seen in C++, and I wish other languages had it as well. I just want the ability to say that this object should be immutable, and only properly labeled functions can use it. Rust is the only other language I’ve found that supports a similar construct. (I suppose you can do it with interfaces in Java, but it’s clunky and too many interfaces start to make Java a pain.)

So ya, I can’t decide if the pains of rust are worth the amazing trade-offs. If I’m writing security conscious code there is no question that Rust is the best. For simple personal projects, it might be a bit much.

Python

As opposed to Rust, Python is the beautiful child that I struggle to love.

I cannot deny that I have been amazed by Python’s simplicity. I’ve been doing some machine learning lately, and it amazes me that in less than 100 lines of code I can train deep neural nets that are shockingly good.

I think the single worst part of Python is its lack of strong typing. While this makes it easy to write simple programs because you don’t have to think about types. As soon as you write anything over 500 lines there is a pretty good chance that the lack of required types is going to make your life difficult.

You can of course include the optional type hints on all your functions. But they are not binding, and once you start dealing with a library that doesn’t use them you IDE no longer knows what anything is. Luckily most libraries are pretty good about this. But if your library has functions that return any, I am going to be very angry.

Python is also slow. And the fact that it is interpreted is not an excuse. Java is also interpreted (I know it’s a little different, but my point still stands), and it is orders of magnitude faster than Python.

Though it is slow, and its type system is a mess, I can’t argue that Python is still an incredibly easy to use and useful language. I also commend it seamless use of c libraries to make many tasks run as fast as c.

Other Languages

These are all languages I have merely dabbled in, or are perhaps not considered programming languages in some spaces.

JavaScript

Backbone of the web. Super useful. I initially like it more than python. But as the rumor goes it was designed in 11 days, and there are few interactions (particularly equality interactions) that show this was likely the case.

TypeScript

Just seems like better JavaScript to me.

Haskell

Had to use this in one of my college classes. Actually learned a ton from it. It can stay in the Computer Science research space though.

C#

Never Used it, though I’ve only heard good things about it. It can get a bad rap for just being Microsoft’s copy of Java, but apparently they did some really good things with it.

The only part that I’m skeptical about is that it seems to blur the line between a simple .exe file and an interpreted language. Making sure to include the right .dll files might be a little tricky when first getting things setup.

SQL

It’s quite adequate for the task it performs. I only wish every company didn’t make its own version. Why can there not be one unified SQL. 😭

HTML/XML

XML is really hard for humans to read. But from a technical perspective, the more you look into it, it is probably the most complete data storage language that exists. JSON is easier to read, but you can’t represent the same number of interactions you can in XML.

HTML is just XML (though they have strayed off the path recently and not all HTML is valid XML).

Conclusion

There you have it, my opinion on various programming languages. I would say that my favorite at the moment is Golang. It just fits the casual vibe I have for a lot of my projects, and it lets me get stuff done quicker while still being efficient and easily distributable.