The Crystal Programming Language Forum

Why to learn Crystal?

If someone asks you why should they learn Crystal what would you tell them?

“Why would you not want to learn crystal?”

  • Super readable
  • It’s fast
  • Concurrency
  • And…

It has a fantastic community!

3 Likes

Friendly like Ruby and efficient as C++ is the first one that comes to my mind.

Expanding on that, one cannot stress enough the benefits of static typing, in particular for larger code bases. Being able to write terse code that almost reads like prose, catch errors at compile time, and have top performance at the same time, imho, is a developer’s pipe dream come true. And being able to transfer existing knowledge from Ruby too? Plus the channel based concurrency, lightweight fibers, easy interfacing with C (or other languages using the C ABI), a comprehensive standard library and a rich ecosystem of shards…

Also, while I expect the main use case being application development, either desktop or back-end, apparently Crystal is just as good for system programming – I didn’t check them out but I read there is people writing operating systems in it and also running it on Raspberry.

This, from a generic, hobbyist coder perspective, but I guess there are good arguments for business too. Developer productivity matters a lot in that context, and once the prototype application works, there’s hardly a need to rewrite anything for performance. And it’s developed and actively used by a firm with an impressive portfolio of achievements. It means it’s not going away, and the creators bet their endeavor on it.

From an education perspective, it’s executable pseudo code. Alright, some scripting languages may fit the bill better, but again, I say static typing, and multi paradigm too.

That it’s open source is an obvious plus for anyone.

Sure, it’s not the only language with some or even most of these features, and some use cases may be better served by other tools, but Crystal sits in a sweet spot for me.

9 Likes

(From an old post I wrote)

In my quest for a powerful programming language for my pet project and after inspecting half a dozen of them (including Go, Nim, D, V and others) I settled with Crystal https://crystal-lang.org

Why Crystal?

  • Ruby-like syntax that is super-easy and pleasant: Making it easy to read, debug, modify and evolve.
  • Concise and brief requiring considerably less lines of code without sacrificing readability.
  • Fully Object Oriented and not opinionated (unlike GoLang).
  • Compiled and Statically-typed language reducing errors and bugs.
  • Much better performance (order of magnitude faster compared to interpreted counterparts: Ruby, python and PHP) and comparable to C. Consider the benefit of going down to 10% of your hosting cost.
  • Can be complied into a single static binary. Making it ideal for limited environments or containerization
  • Cross-platform. Linux and MacOS. Mobile /Windows not sure
  • Built-in testing library (called “spec”)
  • Integrates with existing C libraries.
  • General-purpose: system programming, game and web application development.
  • Supports Generics and has powerful macros

Downsides of Crystal

  • Small community and ecosystem (not many libraries)
  • Slow compiler

I’m sure the listing of pros and cons could go much longer. This is just to highlight the potential.

13 Likes