Ruby 3.0
Esoteric, Obfuscated, Artistic Programming in Ruby

Summarized using AI

Esoteric, Obfuscated, Artistic Programming in Ruby

Yusuke Endoh • November 28, 2017 • New Orleans, LA

The video titled "Esoteric, Obfuscated, Artistic Programming in Ruby" presented by Yusuke Endoh at RubyConf 2017 explores the unconventional aspects of programming in Ruby. The speaker, a committed Ruby interpreter and contributor, aims to demonstrate the creative potential of Ruby's syntax beyond its typically easy-to-read style.

Key points discussed include:
- Introduction to Yusuke Endoh: Yusuke shares his background in Ruby development, including his work to improve Ruby's performance metrics and contributions to features in previous Ruby versions.
- Ruby's Flexibility: The talk emphasizes Ruby's capacity to allow both readable and intentionally obfuscated code, showcasing the language's richness and versatility.
- Obfuscated Code Examples: Yusuke presents several programs that illustrate extreme obfuscation techniques:
- A 'Hello, World!' program constructed with purely alphabetic characters, demonstrating how to conceal traditional syntax.
- Techniques for creating integers and strings using only symbols and how to print outputs with unconventional coding styles.
- A unique 1999 ASCII code example that uses only letters, emphasizing how complexity can emerge while avoiding typical symbols.
- Discussion on Readability vs. Complexity: The presentation argues that despite the complexity of the examples shown, Ruby could lead to increased readability through structured management of strings and variables, enabling both artistic and functional coding.
- Artistic Expression through Code: Yusuke posits that Ruby can function not merely as a programming tool but also as a medium for artistic expression, where the nuances in code bring about joy and creativity.

Conclusion: In concluding, Yusuke affirms Ruby's unique position among programming languages, accommodating personal expression and complex structures without sacrificing clarity. The talk encourages programmers to explore creativity within coding, embracing Ruby's flexibility to innovate in both aesthetics and functionality.

Esoteric, Obfuscated, Artistic Programming in Ruby
Yusuke Endoh • November 28, 2017 • New Orleans, LA

Esoteric, Obfuscated, Artistic Programming in Ruby by Yusuke Endoh

Ruby has a rich and flexible syntax. It allows us to write not only an easy-to-read program, but also an "hard-to-read" one. This talk will show its unlimited power. We present and demonstrate some esoteric, obfuscated, and even artistic programs that we have ever created, including a program that contains a spinning globe, a robust program that can have any single character removed and still works, a program that consists only of alphabetical letters, and so on. We will also review the implementation techniques.

RubyConf 2017

00:00:00 I think it's time for my talk about aesthetic, obfuscated, and artistic programming in Ruby. This is my first talk, and I will discuss some eccentric Ruby programs that I have created.
00:00:18 I'm nervous because this is my first week presenting in English after ten years. Thank you for your support; I'll do my best. First, let me introduce myself. I'm Yusuke Endoh, and my handle is 'Mamita' on Twitter, which means 'peas or beans' in Japanese. Many of my Japanese friends call me 'Mamasan', which corresponds to 'Mr. Bean'.
00:00:39 I'm a committed Ruby interpreter at MRI and I contribute to Ruby as well. Currently, I'm working at Cookpad, a company that provides a cooking recipe sharing service. Cookpad has improved performance metrics, and we aim to contribute to Ruby 3.0, which you know has a target of improving performance by three times.
00:01:07 My aspiration is to lower program latency through various approaches, including contributions to the design of the Ruby 3 type system and improving measurement techniques. I've contributed to Ruby for ten years and was a release manager for Ruby 2.0, implementing features such as garbage collection improvements and keyword arguments.
00:01:36 My notable contribution to Ruby includes developing a Ruby emulator for the Nintendo Entertainment System called 'Carrot', which is based on Ruby. I also improved the average measurement tool so that now it supports branch coverage, and this feature will be included in Ruby 2.5.
00:02:01 This talk, however, is not about all those technical improvements. Today, I will discuss Ruby's potential to create esoteric and obfuscated code. Ruby is known for being easy to read and write, but I believe this perception can sometimes be misleading.
00:02:28 While many people here may believe Ruby is easy to read, I can't help but argue there’s complexity hidden beneath its simple syntax. Ruby's richness and flexibility allow us to write not only readable code but also intentionally obfuscated code.
00:03:01 So, for today, I will showcase only extremely bad examples that abuse Ruby's power. Just a warning, you shouldn't expect anything practically useful from this talk. I won't discuss good practices or useful patterns but will focus on creatively misusing Ruby.
00:03:17 Let's dive into some esoteric examples. I created this one that contains only alphabetic characters, and it is intentionally hard to read due to a lack of syntax. When I highlight the characters, they may not be very apparent at first glance, but this is still a complete program.
00:03:47 This program is essentially just a 'Hello, World!' implementation. As you may know, 'Hello, World!' is the most basic program that outputs a simple greeting. However, I believe you can indeed obfuscate this further.
00:04:09 To demonstrate how I implemented this program, if you want to read the code, it requires a little bit of a spoiler. Please brace yourselves. I created this program using three key techniques: how to make numbers using only symbols, how to make a string, and finally, how to print that single character.
00:04:36 The first technique is creating integers using simple characters. It is straightforward when you know about Ruby's method for matching regular expressions. This method returns the beginning index of the matching string.
00:04:57 The matching pattern returns various numbers based on the string you use. For example, if you use a string that corresponds to a character's code point, it will return the integer value of that character.
00:05:14 The second key is how to make a string using numbers. You can append to a string using its ASCII code points. For instance, the code point for the letter 'H' is 72, and for 'e', it is 101.
00:05:37 Finally, to print the created string, you can use Ruby's special variable to direct output to standard output, and you can append the string you generated. By combining these techniques, you can write a very basic 'Hello, World!' program consisting of only simple characters.
00:06:01 However, writing this string in an obfuscated way can replace the code with numbers and symbols, as demonstrated. You can create complex programs while this program still maps back to how Ruby interprets them.
00:06:29 Additionally, this can lead to even more complex 'Hello, World!' programs. You might be surprised, but it's possible to create commands using only symbols. There’s a well-known idiom that encodes strings using symbols.
00:06:49 This idiomatic expression has stunning details; however, explaining it without a concrete example may be challenging.
00:07:06 Next, allow me to share a program that consists of pure alphabetic characters. This is a 1999 ASCII code that utilizes only alphabets, eliminating symbols entirely.
00:07:29 Let’s run this completely alphabetic code program to see how it functions. Once executed, it should display the expected output.
00:07:57 This program illustrates how Ruby can enable creative uses without relying on traditional symbols. While this method often faces criticism for its complexity, I believe it can lead to increased readability.
00:08:16 The basic structure of any functional Ruby code relies on initializing variables and concatenating them effectively. By managing string operations, even complex programs can maintain this readability.
00:08:37 Furthermore, many may question how to entirely remove symbols to align with this obfuscated programming style. One approach I used was leveraging Ruby’s flexibility to translate specific elements into a purely alphabetic structure.
00:08:56 Ultimately, learning how to manipulate Ruby to emphasize readability over syntax can result in other rich programming experiences. With various experiments, incredible results can emerge.
00:09:12 As I showcase various solutions today, like program structuring and obfuscation techniques, they are designed to illustrate Ruby's ability to offer both expressiveness and strictness in programming.
00:09:38 I envision Ruby not just as a coding tool but rather as a medium for artistic expression, where every line has meaning yet remains nimble enough to adapt to intricate variations.
00:10:03 As my final example, I hope to give you a clear picture of how coding can be both artistic and pragmatic, as this process should bring joy through creativity.
00:10:29 To conclude my talk, Ruby stands out as a unique language, rich in features, yet allowing personal nuances to shine through in every program written.
00:10:50 Thank you for your time, and I look forward to sharing more insights in the future.
Explore all talks recorded at RubyConf 2017
+83