# Book: Programming Crystal

**URL:** <https://forum.crystal-lang.org/t/book-programming-crystal/409>\
**Category:** Learning Resources\
**Created:** [February 11, 2019, 12:29pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409 "2019-02-11T12:29:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonstl](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@simonstl](https://forum.crystal-lang.org/u/simonstl)\
**Post date:** [February 11, 2019, 12:29pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/1 "2019-02-11T12:29:44Z")

</div>

I’m delighted to announce that _Programming Crystal_, written by Ivo Balbaert and myself, is now available in print as well as electronically:

[https://pragprog.com/book/crystal/programming-crystal](https://pragprog.com/book/crystal/programming-crystal)

We tried to keep the book accessible to a broad audience, assuming programming knowledge but not Ruby mastery. We provide a broad overview of how to apply the language, with special attention given to Crystal’s strong interest in type safety. Ivo interviewed companies working with Crystal today, and their stories at the end of each chapter give real-world context to a very new language.

It’s brief - 226 pages - and we hope it will be a solid introduction for anyone approaching the language.

Thank you,  
Simon St.Laurent

---

<div class="post-metadata">

**Author:** ![vlazar](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/vlazar/32/31_2.png) [@vlazar](https://forum.crystal-lang.org/u/vlazar)\
**Post date:** [February 11, 2019, 7:32pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/2 "2019-02-11T19:32:26Z")

</div>

Thanks for the first book on Crystal from pragprog!

Although I would have enjoyed more technical content in book I also find the interviews part very interesting and important as I believe that’s what Crystal needs a lot right now:

People sharing their stories on how they use pre 1.0 programming language in production 😨 and what are their experience (spoiler - it’s very positive!).

---

<div class="post-metadata">

**Author:** ![darenw](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/darenw/32/647_2.png) [@darenw](https://forum.crystal-lang.org/u/darenw)\
**Post date:** [December 28, 2019, 5:37am UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/3 "2019-12-28T05:37:51Z")

</div>

This book is on my shopping list! Might be a few months before I can buy it, as I’m flat broke for now. But I will use Crystal as best I can in the meantime. Having something to read that isn’t technical reference, API reference, or a blog post or article on a narrow topic or small toy programs, will be helpful to those of us new to Crystal but experienced with other languages.

---

<div class="post-metadata">

**Author:** ![mateuszwieloch](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@mateuszwieloch](https://forum.crystal-lang.org/u/mateuszwieloch)\
**Post date:** [December 28, 2019, 6:08am UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/4 "2019-12-28T06:08:06Z")

</div>

Huge congratulations! I’m so glad to see this book finished. Hopefully, it will help Crystal pick up some followers.

I’m reading the book right now on O’Reilly Learning (2 chapters done so far) and so far so good. I wish it was more in-depth, but it’s a good introductory one. Maybe in the 2nd ed! 😉

---

<div class="post-metadata">

**Author:** ![nico](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/nico/32/692_2.png) [@nico](https://forum.crystal-lang.org/u/nico)\
**Post date:** [January 29, 2020, 10:53pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/5 "2020-01-29T22:53:14Z")

</div>

I’m reading this book, so far it’s nice 🙂

---

<div class="post-metadata">

**Author:** ![kees](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/kees/32/914_2.png) [@kees](https://forum.crystal-lang.org/u/kees)\
**Post date:** [February 12, 2020, 7:15pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/6 "2020-02-12T19:15:54Z")

</div>

I was trying to learn Crystal alonside with Ruby, but since Crystal had my most interest, I finally bought the book.  
@simonstl in Your Turn 6, there is an ‘a’ and a ‘b’, the classes.cr in the exercises directory only answers ‘b’, the hint is to use self, but it also works without, but better with self?  
Here is my version for both a and b:

```crystal
class Mineral
   getter common_name : String
   setter common_name
   getter hardness : Float64
   getter crystal_struct : (String | Nil) # YT6a: union
   setter crystal_struct

   def initialize(@common_name, @hardness, @crystal_struct)
   end

   def describe
      "This is #{common_name} with a Mohs hardness of #{hardness} \
and a structure of #{crystal_struct}."
   end

   def to_s # YT6b: string representation of the Mineral object
      "#{common_name}, #{hardness}, #{crystal_struct}" # works without 'self'
   end
end

min = Mineral.new("talc", 1.0, "monoclinic")
puts "#{min.describe} (with initial structure)"
puts min.to_s

min = Mineral.new("diamond", 10.0, nil)
puts "#{min.describe} (no initial structure)"
min.crystal_struct = "cubic"
puts "#{min.describe} (structure added)"
puts min.to_s

```

---

<div class="post-metadata">

**Author:** ![kees](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/kees/32/914_2.png) [@kees](https://forum.crystal-lang.org/u/kees)\
**Post date:** [February 12, 2020, 9:13pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/7 "2020-02-12T21:13:51Z")

</div>

As an addition to my previous message, union.cr is supposed to be the answer to Your Turn 6a.  
But it is only 3 lines showing the definition of an union, not the answer to the question in my opinion.  
My post is meant to improve the book/answers, not to criticize, because I like it so far very much!

---

<div class="post-metadata">

**Author:** ![pebauer68](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/pebauer68/32/1008_2.png) [@pebauer68](https://forum.crystal-lang.org/u/pebauer68)\
**Post date:** [May 18, 2020, 10:48am UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/8 "2020-05-18T10:48:30Z")

</div>

Some pages are free to read here:  
The books looks really good.

> **[foundations.pdf](https://media.pragprog.com/titles/crystal/foundations.pdf)**
>
> 1190.95 KB

  

> **[Ivo-Balbaert/programming\_crystal](https://github.com/Ivo-Balbaert/programming_crystal)**
>
> Code from the book: Programming Crystal (PragProg 2017-18) - Ivo-Balbaert/programming\_crystal

---

<div class="post-metadata">

**Author:** ![wrq](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/wrq/32/761_2.png) [@wrq](https://forum.crystal-lang.org/u/wrq)\
**Post date:** [May 18, 2020, 8:06pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/9 "2020-05-18T20:06:46Z")

</div>

Oh wow! Fantastic!

I read your book about Erlang a while back, you have such a graceful way of explaining things. I’ll pick this up ASAP.

---

<div class="post-metadata">

**Author:** ![ducktape](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/ducktape/32/846_2.png) [@ducktape](https://forum.crystal-lang.org/u/ducktape)\
**Post date:** [May 23, 2020, 12:49pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/10 "2020-05-23T12:49:53Z")

</div>

I just finished this book! Thank you! As someone who has read more than a few books like this, yours really stood out as just the right blend of information density and conciseness.

---

<div class="post-metadata">

**Author:** ![tuxaanand](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/tuxaanand/32/888_2.png) [@tuxaanand](https://forum.crystal-lang.org/u/tuxaanand)\
**Post date:** [June 18, 2020, 4:45am UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/11 "2020-06-18T04:45:07Z")

</div>

Is a new edition coming up for “Programming Crystal”?

---

<div class="post-metadata">

**Author:** ![yb66](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/yb66/32/739_2.png) [@yb66](https://forum.crystal-lang.org/u/yb66)\
**Post date:** [January 26, 2021, 12:07am UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/12 "2021-01-26T00:07:17Z")

</div>

Just wanted to say many thanks to both of you for writing the book, it was excellent. I feel confident now that I can really use Crystal moving forward.

---

<div class="post-metadata">

**Author:** ![alexbottoni](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/alexbottoni/32/1057_2.png) [@alexbottoni](https://forum.crystal-lang.org/u/alexbottoni)\
**Post date:** [February 2, 2021, 3:22pm UTC](https://forum.crystal-lang.org/t/book-programming-crystal/409/13 "2021-02-02T15:22:27Z")

</div>

I bought the book some weeks ago and I finished it in a couple of days. It is a very nice book and can be considered a very good introduction to the language and to its ecosystem. I’m still using it while trying to build my first app with Crystal. It is of great help. I strongly suggest new Crystal programmers to buy and read it. It will save them a lot of try-and-error.

My only complaint is that it is too small. Crystal is a small and nice language and can be effectively described in a few pages but its ecosystem is rapidly growing and would deserve some more documentation. In particular, it would be important to have a detailed description of the tools used to interface Crystal with C and C++ libraries.

My personal hope is to see soon a new, improved, larger version of this book.
