Slide 1

Slide 1 text

Vinicius Stock The state of Ruby tooling

Slide 2

Slide 2 text

Vinicius Stock Sta ff dev Ruby DX team @ Shopify X / GitHub: @vinistock https://vinistock.com

Slide 3

Slide 3 text

Is having options a good thing?

Slide 4

Slide 4 text

Flexibility, freedom, autonomy

Slide 5

Slide 5 text

Sources: When Choice is Demotivating: Can One Desire Too Much of a Good Thing? - Sheena S. Iyengar, Mark R. Lepper 2000 Journal of Personality and Social Psychology, 2000, Vol. 79, No. 6, 995-1006 • consider smaller portion of the available information • simplify their decision making • prefer the default option • make no choice at all When Choice is Demotivating: Can One Desire Too Much of a Good Thing? Complexity Options choice overload

Slide 6

Slide 6 text

Today, I want to talk about options in the context of developer experience

Slide 7

Slide 7 text

Where is the Ruby community currently at in terms of developer experience (DX)?

Slide 8

Slide 8 text

It’s common to hear that tooling for Ruby is di ff i cult to make because it is too dynamic

Slide 9

Slide 9 text

I don’t believe that’s the main source of di ff i culty with tooling

Slide 10

Slide 10 text

The main challenge for a modern developer fragmentation experience in Ruby is

Slide 11

Slide 11 text

Story of a new developer

Slide 12

Slide 12 text

They want a complete developer experience while trying Rust and Ruby

Slide 13

Slide 13 text

How to manage Rust? Rustup

Slide 14

Slide 14 text

Tests? Built-in

Slide 15

Slide 15 text

Formatting? Rustfmt

Slide 16

Slide 16 text

Linting? Clippy

Slide 17

Slide 17 text

Language server? Rust analyzer And so on

Slide 18

Slide 18 text

Rust’s well integrated experience didn’t happen by accident Source: https://www.rust-lang.org/governance/teams/dev-tools Rust has a dedicated developer tooling team Responsible for designing a cohesive experience and coordinating e ff orts

Slide 19

Slide 19 text

Modern default tools + guidance Consolidated tooling Easy integration Minimal decisions Reduced learning curve Minimal con fi guration High collaboration

Slide 20

Slide 20 text

Direnv RubyInstaller Shadowenv Mise asdf chruby Frum rbenv rvm Homebrew How to manage my Ruby install? ruby-install

Slide 21

Slide 21 text

Tests? Test Unit Minitest RSpec Sus Cucumber

Slide 22

Slide 22 text

Types? TypeProf Steep RDL YARD Sorbet

Slide 23

Slide 23 text

Formatting /linting? Syntax Tree Standard Rubyfmt Rufo RuboCop Reek

Slide 24

Slide 24 text

Language server? TypeProf Steep Ruby LSP Solargraph Sorbet RuboCop LSP Standard LSP Syntax Tree LSP Continues…

Slide 25

Slide 25 text

Rust: 1 combination Ruby: 13200 combinations Considering: • Full experience • Single choice • Lists not exhaustive

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Project A Project B Open source project C asdf No typing RuboCop RSpec rbenv Steep / RBS Standard Test Unit Mise Sorbet Rubyfmt Minitest

Slide 29

Slide 29 text

Missing defaults and guidance Dif fi cult integration Excessive decisions for new developers Tooling fragmentation Too much con fi guration Spreading our efforts Steeper learning curve Community driven tools DX design is delegated

Slide 30

Slide 30 text

JavaScript is another fragmented ecosystem Source: https://survey.stackover fl ow.co/2023/#technology-most-popular-technologies But they have a much larger community JavaScript: 63.61% Rust: 13.05 % Ruby: 6.23% We can’t a ff ord to divide our e ff orts

Slide 31

Slide 31 text

Contributors (not unique) Sorbet + Steep + Solargraph + Ruby LSP + TypeProf = Rust Analyzer = 816 603

Slide 32

Slide 32 text

Building new tools might make sense More tools != Better experience We need to consider the big picture of DX DX is not about any one tool. It’s about the combination of them

Slide 33

Slide 33 text

Sources: When Choice is Demotivating: Can One Desire Too Much of a Good Thing? - Sheena S. Iyengar, Mark R. Lepper 2000 Journal of Personality and Social Psychology, 2000, Vol. 79, No. 6, 995-1006 • make no choice at all When Choice is Demotivating: Can One Desire Too Much of a Good Thing? • consider smaller portion of the available information • simplify their decision making • prefer the default option

Slide 34

Slide 34 text

• make no choice at all Evaluating the alternatives requires too much e ff ort
 
 Best case: having a worse developer experience Worse case: deciding to not try Ruby

Slide 35

Slide 35 text

• prefer the default option Our defaults are so good they don’t have to choose

Slide 36

Slide 36 text

Using the tools is not the final goal Tools are a stepping stone. The goal is to build things Setting up your development environment should be e ff ortless So that developers can fully focus on what they want to build

Slide 37

Slide 37 text

Tools as project dependencies

Slide 38

Slide 38 text

In Ruby, it’s common to add tools as project dependencies But why? # Gemfile group :development do gem “formatter” gem “debug” end

Slide 39

Slide 39 text

Version consistency in the same project But not much else

Slide 40

Slide 40 text

Rust components rustup component add rustfmt clippy rust-analyzer

Slide 41

Slide 41 text

Tools installed globally Version consistency in any project Auto-updates Global installation already in the PATH Reduced maintenance Tools can easily integrate with the project’s dependencies

Slide 42

Slide 42 text

Could we do the same?

Slide 43

Slide 43 text

What can the future look like for tooling?

Slide 44

Slide 44 text

Rust’s case is the exception Fragmented • Ruby • Python • JavaScript • C / C++ • Java • PHP Consolidated • Rust • Go 1995 1991 1995 1970s / 1985 1996 1995 2015 2009

Slide 45

Slide 45 text

Nothing stops us from learning from Rust’s success

Slide 46

Slide 46 text

There’s already a move towards consolidation Prism is unifying all static analysis e ff orts

Slide 47

Slide 47 text

Prism Prism::Index Code mods Ruby LSP Linter Type checker Formatter RDoc Deprecation framework

Slide 48

Slide 48 text

This is very long term, but we can achieve it The challenges for a modern developer experience are not technical So what’s missing?

Slide 49

Slide 49 text

• Is it coordination? • Is it collaboration? • Is it governance? Do any of these look like a problem we can’t solve?

Slide 50

Slide 50 text

How to have a more integrated experience right now?

Slide 51

Slide 51 text

Language server protocol But now we have language server fragmentation

Slide 52

Slide 52 text

Language server 3 Code index Language server 2 Code index Language server 1 Code index Extension host Document 1 Document 1 Document 1 Open document 1 Open document 1 Open document 1 Editor Indexing…

Slide 53

Slide 53 text

• Duplicate work • Increased memory usage • Each language server can potentially make the other slower

Slide 54

Slide 54 text

If we consolidate language servers, we can do a better job at integrating the rest of the ecosystem

Slide 55

Slide 55 text

The Ruby LSP can help

Slide 56

Slide 56 text

Ruby LSP addons Source: https://github.com/Shopify/ruby-lsp/blob/main/ADDONS.md A way for other gems to deliver integrations in the editor

Slide 57

Slide 57 text

Ruby LSP addons • No need to write a VS Code/editor extension • No need to write a brand new language server Source: https://github.com/Shopify/ruby-lsp/blob/main/ADDONS.md • No need to build your own static analysis tools

Slide 58

Slide 58 text

Encoding helpers Ruby LSP Codebase index Addon Static tools Response builders Type resolver

Slide 59

Slide 59 text

Language server Code index Extension host Document 1 Editor Rails addon Test addon Linter addon Type checker addon

Slide 60

Slide 60 text

Ruby LSP addons • Ruby LSP Rails https://github.com/Shopify/ruby-lsp-rails • Ruby LSP RSpec https://github.com/st0012/ruby-lsp-rspec • Internal integrations with RuboCop, Syntax Tree, Minitest and Test Unit Source: https://github.com/Shopify/ruby-lsp/blob/main/ADDONS.md

Slide 61

Slide 61 text

The most important steps to advance Ruby developer experience: • Consider the big picture • Coordinate our e ff orts

Slide 62

Slide 62 text

Thank you