Spotlight: Noel Rappin (Author)

A Ruby-Centric Chat
with Noel Rappin
@noelrappin

noel

Once you start noodling around with Ruby you quickly figure out, as Noel Rappin did, that it offers fantastic flexibility with dynamic typing, metaprogramming, and reflection, among other features. What’s more, it’s fun. Ruby’s clean syntax and conciseness allow you to focus on solving problems rather than thinking about language intricacies. When you are coming from Java, that’s a refreshing change.

We sat down with Noel to talk about his journey from learning Basic as a young person to programming in Java professionally, and finally his move to Ruby.

WIN!

We’re giving away one of Noel’s books to one lucky winner! Simply post a comment or a question in his ask me anything (AMA) below, and the Devtalk bot will randomly pick a winner at a time of the author’s choosing . . . then automatically update this thread with the results!


INTERVIEW (abridged)

Introducing Noel

Noel Rappin has been a PragProg author for years and has recently taken on updating the pickaxe book: Programming Ruby, now in its fifth edition. He’s also our Ruby and Rails Series Editor, helping The Pragmatic Bookshelf to shape the future of books about programming in Ruby.

Raised in the Apple II generation, he was naturally curious about computers, and took after-school programming classes at the Kohl Computer Loft in Chicago—what is now the Kohl Children’s museum. Experimenting at home in Basic and Turbo Pascal, he says: “I wrote myself a flashcard program for Spanish language vocabulary—not that it helped me very much in Spanish—but it helped me in programming.”

On becoming a Java programmer . . .

Noel has both an undergraduate and graduate degree in computer science. He was exposed to C as an undergrad, but in grad school experimented with “a variety of dynamic, weird, and fringy languages.”

We’re talking HyperCard, Macintosh Common Lisp, Smalltalk, and “this really cool language called Prograph, which was a visual language where the code looked like a flow chart. You would actually drag and drop stuff and draw lines between things to have things done.”

While those languages were interesting, none were commercially viable, and Noel wound up programming professionally in Java, doing “boring enterprise-y kind of stuff” and not loving the environment or tools, so was continually playing with other languages.

On moving to Ruby . . .

“There’s an aesthetic to Java libraries where many Java libraries are built to make the thing that you do 1 percent of the time easy while making the thing you do 95 percent of the time more complicated.”

“Ruby libraries are the exact opposite. Most Ruby libraries are designed to make the thing you do 95 percent of the time really easy and the thing you do 1 percent of the time really hard. Sometimes meaning that the thing you do 1 percent of the time is not a thing you should be doing with that tool.”

Noel had been following extreme programming and Ruby from the early days via Internet mailing lists, and when the original Pickaxe book came out, Noel bought it as a birthday present for himself.

His next job was full-time Ruby, and he never looked back—that was over fifteen years ago.

On learning Ruby . . .

When you come to Ruby from a strictly typed language like Java, dynamic typing can be surprising. You have to change your mindset to a more dynamic way of looking at your code and how it behaves.

There’s a learning curve—working with those dynamics and getting used to an environment where everything is an object. Even things like numbers and strings, which have special syntax even in other object-oriented languages, behave the same way as every other object.

Ruby feels like a language designed to be a fancier Perl that was then colonized by SmallTalk programmers. Noel’s early Smalltalk experiences helped him learn Ruby because of their similarities. They’re both late-binding languages that don’t evaluate whether the object can receive the message being passed until it’s actually being evaluated.

“I love Smalltalk. For a long time, I would generally, at every new job, wind up giving a twenty-five-minute demo of how great Squeak Smalltalk or later Pharo Smalltalk were. Even just a couple of weeks ago, I was looking at Kent Beck’s Smalltalk Best Practice Patterns as a guide to how to do Ruby better, because even as a Smalltalk book it’s one of the best Ruby books around.”

On programmer happiness . . .

“Ruby has, from its very beginning, this sense of programmer-facing aesthetics being very important.” Take RSpec—it’s a testing library that allows you to write tests that read like native language.

Ruby’s standard library is at heart "batteries included.” String has two hundred plus methods for basic and not-basic string manipulation. Code you don’t have to write—and that philosophy extends to other libraries.

Similar tools in the Ruby community take seriously the idea of making the programmer interface easy. In fact, Yukihiro Matsumoto, Ruby’s creator, talks about Ruby being optimized for programmer happiness.

On correctness . . .

“The first Ruby community event I ever attended, Dave Thomas started off with a talk about Ruby metaprogramming, and he addressed this very issue and described it as more of a people problem than a technology problem.”

“There are technological solutions to this problem; one which Ruby developers use a lot is that they tend to be very aggressive about writing tests, because automated tests fill some of the purpose that static typing might have in another language.”

Ruby has some idiomatic style guidance that makes you aware of when you are doing something potentially dangerous and compels you to be mindful.

“I think that one of the things that the Programming Ruby book does historically very well, from Dave’s and Andy and Chad’s original text, is explain that a lot of the things that you think are going to go wrong when you leave behind a static typing language to come to Ruby just sort of don’t happen, because Ruby methods tend to be small, so it tends to be fairly easy to see the behavior of an individual object inside a method.”

Working with Ruby you come to realize the benefit of “not strictness,” and the cost of strictness.

People have built some pretty big programs using Ruby on Rails. Even without strong typing, these programs keep working. It’s a combination of tests, naming conventions, and structure that mean errors are difficult to make and even more difficult to persist. Often when you make an error, it’s very loud and you catch it very quickly. It’s not as scary as you might think coming from a strongly typed language to move to a dynamically typed language.

On programming features (friend or foe) . . .

We asked Noel to comment on some programming features and classify them as “friend or foe.”

Singletons

“Hmmm. In between.”

“A singleton is an object-oriented term for a class that only has one instance, one (usually) globally available instance. They are helpful in some cases where you work with a genuinely global state. They are problematic in other instances because weird global state can make things hard to replicate.”

“Ruby has an internal module that will let you convert any class into a singleton. It’s useful sometimes. In cases where you legitimately want only one of something in your system it can be overused. I don’t think it’s tremendously overused in a Ruby context.”

Reflection

“Friend.”

“Reflection internally is the programming language’s ability to understand its own structures. It’s best friend. It’s core to Ruby to be able to have a class be able to reflect on what methods it has and what methods it doesn’t have. Or what instance variables have already been declared for it or haven’t been. Anything like that, or what classes even exist or don’t exist.”

“Ruby has all kinds of very useful mechanisms that depend on its ability to reflect at runtime on the structure of the program.”

Mix-ins

“I feel like I’m playing Jeopardy. A mix-in is a specific kind of module that is used to add functionality to an existing class. This is more also on the best friend line.”

“Mix-ins are a very core piece of Ruby implementation. It’s a way that Ruby sort of gets around not having multiple inheritance by allowing for an arbitrary number of mix-ins to be added into a class.”

“It is something that is a little bit more useful from libraries than it is in somebody’s application code, often. Ruby has a lot of third-party libraries that propagate themselves by providing mix-ins that you mix into your classes to get certain kinds of behavior.”

On the fifth edition of Programming Ruby . . .

“One of the goals of the original book that I’ve tried to keep up was to make it accessible to Ruby developers at a variety of different levels. If you are an entry-level developer Programming Ruby is great for you because it has a tutorial of how Ruby works and what the main constructs are and how they interact.”

“If you are an intermediate Ruby developer, you have all that plus a curated list of what the best API tools are. As you get more advanced, you’ll find a complete description of the language syntax.”

The pickaxe book covers new features in the language and in the library, but also addresses the population of new developers reading this book who have different reference points.

We take advantage of nine more years of Ruby experience, in terms of what people find hard or easy and what they use or don’t use. For example, developers are more likely to have JavaScript and Python experience than Perl or Java. “We wanted to use that a little bit to inform how we make some of the explanations in the book and how we compare certain Ruby features.”

We also added an appendix of symbols whose names are not obvious with what they’re often called. You get a quick definition and a word that goes along with them. For example, Ruby calls the equal sign followed by a greater than a “hash rocket,” or we talk about the “spaceship operator.”

Overall, there is something in the pickaxe book for every Ruby programmer.

The pickaxe book, named for the tool on the cover, is the definitive Ruby reference—a highly-regarded, fully object-oriented programming language. The fifth edition is a comprehensive reference on the language itself, with a tutorial on the most important features of Ruby—including pattern matching and Ractors—and describes the language through Ruby 3.3.


Now that you know his story, complete your collection of Noel’s PragProg titles today! Don’t forget to use coupon code devtalk.com to save 35 percent on one of Noel’s ebooks:


Follow Noel:

Website, noelrappin.com

Mastodon, noelrap@ruby.social

Newsletter, buttondown.email/noelrap

Linkedin, noelrappin


YOUR TURN!

We’re now opening up the thread for your questions! Ask Noel anything! Please keep it clean and don’t forget by participating you automatically enter the competition to win one of Noel’s ebooks!

3 Likes