Chapter 8
Advanced Features

Now that you’ve seen the foundations of the Crystal language, let’s explore features that you’ll often need in real-life projects:

  • Macros to avoid boilerplate code: Every modern programming language that respects itself can do this. Crystal respects itself and can do this.

  • Binding with C libraries: Sometimes a good C library for your purposes already exists and you just want to use that. Crystal makes this easy: write out the C function names and types and you’re good to go.

  • Concurrency: Running different code parts at the same time. When applied with care, this improves throughput and performance, which is what we all want.

  • Database access: Most apps need to store their data, so this is a no-brainer—you need this. Crystal proposes a unified way to do this.

These techniques will help you persist your app’s data safely and boost its speed. You’ll reuse functionality that already exists in C, and you’ll make your code leaner and smarter by using metaprogramming. These topics aren’t directly related, but applying them will take your Crystal coding to the next level.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.17.139