Book description
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.
Crystal is elegant to read and easy to program like Ruby, allowing full object-oriented development. Its compiler is powerful enough to nearly always infer the type of your variables. So you get the benefits of a statically typed language: more robust code, safety and execution speed, while still reaching high productivity in development. Null pointer exceptions as in JavaScript, Java or C#, are a thing of the past: Crystal annihilates them, just like Rust.
Explore the building blocks and design of the language, and how you can use the Crystal tool-chain to build and manage powerful applications. Harness the power of the macro system, as well as how to work with fibers and channels, making concurrency as easy as possible. Learn how to use the Kemal web framework and access databases, and how to tap the potential of existing Crystal libraries. Find the spot that Crystal fills in today's software world with real-world examples.
With Crystal, you can combine the best of both worlds: the high-level coding of dynamic languages, and the safety and blazing performance of a natively compiled language.
What You Need:
To develop in Crystal, you only need Crystal v 0.26 the latest version, a common text editor and a browser.
Publisher resources
Table of contents
- Preface
-
Part I. Getting Started
-
1. 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
- 2. Crystal Foundations
-
1. Diving into Crystal
-
Part II. Building Blocks
-
3. 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
- 4. Organizing Code in Methods and Procs
- 5. Using Classes and Structs
- 6. Working with Modules
- 7. Managing Projects
-
3. Typing Variables and Controlling the Flow
- Part III. Advanced Crystal
-
Part IV. Appendices
- A1. Setting Up a Crystal Environment
- A2. Porting Ruby Code to Crystal
-
A3. 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
Product information
- Title: Programming Crystal
- Author(s):
- Release date: January 2019
- Publisher(s): Pragmatic Bookshelf
- ISBN: 9781680502862
You might also like
book
Core HTML5 2D Game Programming
Game programming offers a wealth of creative and business opportunities, and it’s never been more accessible. …
book
Vertically Integrated Architectures: Versioned Data Models, Implicit Services, and Persistence-Aware Programming
Understand how and why the separation between layers and tiers in service-oriented architectures holds software developers …
book
Ruby Under a Microscope
Ruby Under a Microscope gives developers an inside, hands-on look at Ruby's core, using simple diagrams …
book
The Book of F#
F# brings the power of functional-first programming to the .NET Framework, a platform for developing software …