Programming Crystal: Create High-Performance, Safe, Concurrent Apps
Book information
Description
This book is for you if you’re a developer who’d like to learn more about what Crystal has to offer and why it will be a useful tool in your software toolbelt. If you already know Ruby, switching to Crystal will be almost effortless—you should feel at home quickly. You can reuse a lot of knowledge, established principles, and practices from the Ruby world in your Crystal projects. You just need to pay some attention to the types of certain variables, and the compiler will help you out with that. You don’t, however, need Ruby experience to get the most from this book. Crystal is also approachable to newcomers from other programming languages, or for newcomers to programming. This book assumes you’re familiar with basic programming terms and concepts. You’ll have a head start if you come from another object-oriented language or a statically compiled language. What’s In This Book This book teaches the basics of Crystal with an emphasis on how its developers structured it's design to make it perform so well. As Crystal is a recent addition to the programming world, convincing companies and people to use it is trickier than promoting familiar tools. To help deal with those challenges, you’ll find discussions about real-world use cases, entitled “A Company’s Story Crystallized,” at the end of each chapter. programming crystal, concurrent apps This book is organized into three parts: Part I - Getting Started We’ll begin by going over all the good reasons why you should use Crystal. Then you’ll set up a working Crystal environment and work through a minitutorial. Part II - Building Blocks This part examines the building blocks of Crystal in much greater depth: variable types, basic and compound data types, control structures, methods, classes, modules, generating docs, testing framework and code formatting. Part III - Advanced Features Once you’ve learned the heart of the language, you can explore Crystal’s features for maximizing code reuse, as well as sharing code and data. Cover Table of Contents Preface Who This Book Is For What’s in This Book How to Read This Book Conventions Used in This Book Web Resources and Feedback Downloading Sample Code Acknowledgments 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 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 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 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 5. Using Classes and Structs 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 6. 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 7. 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 Part III—Advanced Crystal 8. 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 9. 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 Part IV—Appendices A1. 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 A2. Porting Ruby Code to Crystal Ruby Extensions in 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 Index – SYMBOLS – – A – – B – – C – – D – – E – – F – – G – – H – – I – – J – – K – – L – – M – – N – – O – – P – – Q – – R – – S – – T – – U – – V – – W – – Y –
Similar books
Programming Crystal Create High-Performance, Safe, Concurrent Apps
2019 · PDF
Julia 1.0 Programming Complete Reference Guide
2019 · PDF
Learn Red - Fundamentals of Red: Get Up and Running with the Red Language for Full-Stack Development
2018 · EPUB
Learning Rails 3
2012 · EPUB
Julia 1.0 Programming: Dynamic and high-performance programming to build fast scientific applications
2018 · PDF
Julia 1.0 Programming Dynamic and High-Performance Programming to Build Fast Scientific Applications
2018 · EPUB
Introducing Erlang: Getting Started in Functional Programming
2017 · PDF
Introducing Elixir: Getting Started in Functional Programming
2017 · PDF