You program in Ruby but long for greater concurrency. You dream of programs that run instantly when called. You wish everything had clearly defined types. You prefer functional approaches to organizing logic. Ruby is proving to be not just a great programming language, but a great foundation for new programming languages. Elixir and Crystal in particular demonstrate very different ways to build specific approaches based on a classic generalist language.
Ssince its beginning, Ruby has harmonized many different programming approaches into a single language context. Developers arriving from a variety of contexts—object-oriented programming, functional programming, and more—could pick up Ruby and find familiar tools. As Yukihiro “Matz” Matsumoto, Ruby’s creator, put it, “I want to make Ruby users free. I want to give them the freedom to choose.”
Over the years, idiomatic Ruby styles emerged that delivered maintainability and performance, but Ruby has always been a language that can speak in multiple voices. Some of those voices are now stepping out on their own, bringing Ruby syntax and sensibilities to specific contexts. Where Ruby emphasized flexibility and harmony, these new languages target specific uses. Two of the most successful, Elixir and Crystal, have taken starkly different paths. The Ruby DNA of both languages is clear. Rubyists should feel comfortable reading both languages. However, Elixir aims for concurrency by building on Erlang’s extremely functional and dynamically typed approach, and while Crystal supports basic functional programming, it’s much fonder of classical object-oriented approaches and sternly typed.
Join Simon St.Laurent to explore the overlaps between the two languages and Ruby and see how different priorities have created languages with very different best practices. He compares code doing the same simple tasks and provides some explorations of capabilities specific to each language. Along the way, you’ll learn how to choose tools that fit specific tasks and gain a broader sense of how architectural choices percolate through language syntax.
Simon St.Laurent is a content manager at LinkedIn Learning, focusing primarily on the client side of the web. He’s a past cochair of the Fluent and OSCON conferences. He’s authored or coauthored books including Programming Crystal, Introducing Elixir, Introducing Erlang, Learning Rails 3, XML Pocket Reference, 3rd edition, XML: A Primer, and Cookies.
©2019, O'Reilly Media, Inc. • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • email@example.com