July 10, 2024

Byte Class Technology

Byte Class Technology & Sports Update

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

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

Finding out a new programming language can open up your head in techniques you hardly ever assumed achievable. Just like discovering a new human language like Spanish or Mandarin, you discover to think with various words and phrases and constructions.

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

The neat point about programming languages is that the 1st just one you learn is often the toughest. As soon as you comprehend simple structures like if-clauses and for-loops, you will see them popping up in several new languages you may possibly discover.

And, contrary to human languages, new programming languages are significantly faster to master. They are extra rational and have considerably less text — or, ought to I say, commands.

It follows that most programmers and facts scientists grasp far more than 1 programming language.

They could possibly have a major or favorite a person. But most application builders I know use at least 5 languages on a weekly basis, if you count scripting languages in.

Most programmers also consider to find out a new language every single so normally.

It will come with the job. Coding implies staying curious.

The case for Crystal

Crystal, as for each its ad, is a language which is speedy like C and slick like Ruby.

The component about its slickness is true. It’s compiled and statically typed, which will come with its personal strengths and negatives. Previously mentioned all, even so, it’s quite equivalent to Ruby in its type.

Personally I’ve under no circumstances written a bigger undertaking in Ruby. But as a fairly skilled Python developer, Crystal code nevertheless seems crystal distinct!

Here’s an case in point of a recursive loop that calculates factorials:

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