small medium large xlarge

Programming Crystal: Create High-Performance, Safe, Concurrent Apps

by

Cover image for Programming Crystal

Programming Crystal

Create High-Performance, Safe, Concurrent Apps

by

Crystal is for Ruby programmers who want more performance or for developers who enjoy working in a high-level scripting environment. Crystal combines native execution speed and concurrency with Ruby-like syntax, so you will feel right at home. This book, the first available on Crystal, shows you how to write applications that have the beauty and elegance of a modern language, combined with the power of types and modern concurrency tooling. Now you can write beautiful code that runs faster, scales better, and is a breeze to deploy.

Customer Reviews

One of the best introductions to programming with Crystal that I’ve read. Clear examples and excellent explanations make this a must-read for anyone looking to get started with Crystal.

- Dary Merckens

CTO, Gunner Technology

This book has something for everyone. Real stories can motivate adoption and remind us how proud we all must be about this language. It’s a nice introduction for the language itself and to the existing ecosystem that programmers with even little experience will enjoy. Even people that have been using Crystal for a while will find new information in the book. I did!

- Brian J. Cardiff

Research and Dev Lead, Manas. Tech

Ruby’s performance level and concurrency support have troubled me for some time. Here, the authors have definitely encouraged me to convert to Crystal: I got a sort of click experience when I read about Crystal’s nil-safety and my eyes went a little wide as I realized what an enormous improvement this was.

- Nigel Lowry

Company Director, Lemmata, Ltd.

See All Reviews

Choose Your Format(s)

  • $37.95 In Stock

    Save $11.95 on the combo pack.

  • $29.95 In Stock
  • $19.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

To develop in Crystal, you only need Crystal v 0.26, the latest version, a common text editor and a browser.

Contents & Extracts

  • Preface
  • Getting Started
    • Diving into Crystal
      • A Programming Language for Humans and Computers
      • Slick As Ruby, But Way Faster
      • Almost As Fast As C
      • Speeding Up the Web
      • Talking to Databases
      • More Safety Through Types
      • No to the Billion-Dollar Mistake
      • Batteries Included
      • Putting Crystal to Good Use
      • A Company’s Story Crystallized: Red Panthers
      • Wrapping Up
    • Crystal Foundations excerpt
      • Using Basic Variables and Types
      • Variable Operations
      • Structuring Data with Container Types
      • Controlling the Flow
      • Using Methods
      • Organizing Code in Classes and Modules
      • Executing Code Concurrently Through Fibers
      • A Company’s Story Crystallized: Dev Demand
      • Wrapping Up
  • Building Blocks
    • Typing Variables and Controlling the Flow
      • Converting Data Between Types
      • Getting Input
      • Putting It Together—Converting Currencies 1
      • Exception Handling for Faulty Input
      • Chaining Methods
      • Getting Input from Command-Line Arguments
      • Using String Methods
      • Using Symbols as Identifiers
      • Using Enums
      • Using Regular Expressions
      • Putting It Together—Converting Currencies 2
      • Beyond Hashes and Arrays: More Composite Types
      • Nilable Types
      • Controlling the Flow and Types
      • A Company’s Story Crystallized: Linkfeed
      • Wrapping Up
    • Organizing Code in Methods and Procs
      • Passing Arguments
      • Returning Values
      • Working with Yield, Procs, and Blocks
      • Overloading and Multiple Dispatch
      • Using a Shorter Syntax for Exception Handling
      • Using Recursive Methods
      • A Company’s Story Crystallized: Duo Design
      • Wrapping Up
    • Using Classes and Structs excerpt
      • Converting a Ruby Class to Crystal
      • Structuring a Class
      • Applying Inheritance
      • Controlling Visibility
      • Working with Structs
      • Viewing the Type Hierarchy
      • Some Nice Tricks
      • A Company’s Story Crystallized: LI-COR Biosciences
      • Wrapping Up
    • Working with Modules
      • Combining Files with Require
      • Using Modules as Namespaces
      • Letting Modules Extend Themselves
      • Mixing in Modules
      • How the Compiler Finds Methods
      • Applying Built-In Modules
      • A Company’s Story Crystallized: Diploid
      • Wrapping Up
    • Managing Projects
      • Creating a Shard
      • Formatting Code
      • Documenting a Project
      • Writing Tests with Spec
      • Using External Libraries
      • Benchmarking Your Code
      • Deploying a Crystal App
      • A Company’s Story Crystallized: Diploid—Part 2
      • Wrapping Up
  • Advanced Crystal
    • Advanced Features
      • DRY Your Code with Macros
      • Low-Level Programming and C Bindings
      • Creating Concurrent Code
      • Accessing Databases
      • A Company’s Story Crystallized: NeuraLegion
      • Wrapping Up
    • Using Web Frameworks and Shards
      • Build Web Applications with the Kemal and Amber Frameworks
      • A Brief Tour of the Shard Ecosystem
      • A Company’s Story Crystallized: Kemal in Production
      • Wrapping Up and Afterword
  • Appendices
    • Setting Up a Crystal Environment
      • Working with Crystal Online
      • Installing Crystal on Your Machine
      • Compiling Code
      • Using Editors and IDEs
      • Working with Crystal Playground
      • Using Crystal Documentation
      • Wrapping Up
    • Porting Ruby Code to Crystal
      • Ruby Extensions in Crystal
    • Your Turn Answers
      • Chapter 2: Crystal Foundations
      • Chapter 3: Typing Variables and Controlling the Flow
      • Chapter 4: Organizing Code in Methods and Procs
      • Chapter 5: Using Classes and Structs
      • Chapter 6: Working with Modules
      • Chapter 7: Managing Projects
      • Chapter 8: Advanced Features
      • Chapter 9: Web Frameworks and the Shard Ecosystem
      • Appendix 1: Setting Up a Crystal Environment

Author

Ivo Balbaert is a programming teacher and Crystal enthusiast. He has a Ph.D. in Applied Physics and has worked for 25 years in the software industry as a developer and project manager in several companies. Now he combines teaching and consultancy with technical writing. He is particularly interested in elegant emerging languages for concurrency and distributed processing.

Simon St. Laurent is a content manager at LinkedIn Learning, focusing primarily on front-end web projects. He has been co-chair of the Fluent conference and of OSCON. He has authored or co-authored books including Introducing Elixir, Introducing Erlang, Learning Rails 3, XML: A Primer, and Cookies. You can find more of his writing on technology, Quakerism, and the Town of Dryden at simonstl.com.