If Python is too slow for you, Crystal could be your savior

Learning a new programming language can open your mind in ways you never thought possible. Just like learning a new human language like Spanish or Mandarin, you learn to think with different words and structures.

You tap into the cultures and communities of the speakers and learn how they see the world. It’s enriching, to say the least.

The neat thing about programming languages is that the first one you learn is always the hardest. Once you understand basic structures like if-clauses and for-loops, you’ll see them popping up in many new languages you might learn.

Discover the future of tech!

Join us at TNW Conference June 15 & 16 in Amsterdam

And, unlike human languages, new programming languages are much faster to learn. They’re more logical and have less words — or, should I say, commands.

It follows that most programmers and data scientists master more than one programming language.

They might have a main or favorite one. But most software developers I know use at least five languages on a weekly basis, if you count scripting languages in.

Most programmers also try to learn a new language every so often.

It comes with the job. Coding means staying curious.

The case for Crystal

Crystal, as per its advertisement, is a language that’s fast like C and slick like Ruby.

The part about its slickness is true. It’s compiled and statically typed, which comes with its own advantages and disadvantages. Above all, however, it’s very similar to Ruby in its style.

Personally I’ve never written a larger project in Ruby. But as a fairly experienced Python developer, Crystal code still looks crystal clear!

Here’s an example of a recursive loop that calculates factorials:

Factorial calculation in Crystal. Image by author, code taken from Crystal by Example