Slide 1

Slide 1 text

@@export_scripts@@ SPEAKER: Kasper Timm Hansen Speaker Bio: Kasper is an independent Rails consultant with a strong focus on clear naming and Domain Modeling. He used to be on the Rails core team where he reviewed & merged over 1000 contributor PRs. Kasper is still involved in Open Source with his own gems that take Rails further and he’s contracted for Bullet Train too, so he’s more than happy to talk about that work. He’s also developing a new software development technique called Riffing, that he’s amped to see how it could fit and level up you and your team’s process. ROOM: 140 E-G

Slide 2

Slide 2 text

@@export_scripts@@ Riffing on Rails Sketch your way to better designed code

Slide 3

Slide 3 text

@@export_scripts@@ Hi, it's Kasper

Slide 4

Slide 4 text

@@export_scripts@@ Today let's talk about code design

Slide 5

Slide 5 text

@@export_scripts@@ Figuring out the names, responsibilities, and relationships

Slide 6

Slide 6 text

@@export_scripts@@ How do we get better designs?

Slide 7

Slide 7 text

@@export_scripts@@ I don't actually know. Sorry.

Slide 8

Slide 8 text

@@export_scripts@@ Better design requires a process

Slide 9

Slide 9 text

@@export_scripts@@ How this came about

Slide 10

Slide 10 text

@@export_scripts@@ Overwhelmed → Anxious

Slide 11

Slide 11 text

@@export_scripts@@ "I just want to ship"

Slide 12

Slide 12 text

@@export_scripts@@ My way out with riffing

Slide 13

Slide 13 text

@@export_scripts@@ Our meal plan what riffing is 1. benefits 2. obstacles 3. demo 4.

Slide 14

Slide 14 text

@@export_scripts@@ Non compete Just one more tool in your toolbox

Slide 15

Slide 15 text

@@export_scripts@@ how it works - use a single Ruby file - lean on conventions as much as possible - use near runnable code

Slide 16

Slide 16 text

@@export_scripts@@ we're aiming to - learn about the problem - surface unknowns

Slide 17

Slide 17 text

@@export_scripts@@ Sessions are usually ~40-60min

Slide 18

Slide 18 text

@@export_scripts@@ we do a Lil' Demo as a treat

Slide 19

Slide 19 text

@@export_scripts@@ # Users can favorite other objects in our system class User has_many :favorites def favorite(record) = favorites.create!(record:) end class User::Favorite belongs_to :user belongs_to :record, polymorphic: true end class Users::FavoritesController def create Current.user.favorite SignedGlobalID.find(params[:id], only: [Post, Comment], for: :user_favorites) end end

Slide 20

Slide 20 text

@@export_scripts@@ Riffing Benefits

Slide 21

Slide 21 text

@@export_scripts@@ Fewer sunk costs Low Friction

Slide 22

Slide 22 text

@@export_scripts@@ Compare Alternatives

Slide 23

Slide 23 text

@@export_scripts@@ more XP per feature

Slide 24

Slide 24 text

@@export_scripts@@ Embody the problem

Slide 25

Slide 25 text

@@export_scripts@@ Get things out of my head

Slide 26

Slide 26 text

@@export_scripts@@ Negative Emotions are now really useful

Slide 27

Slide 27 text

@@export_scripts@@ Riffing Obstacles

Slide 28

Slide 28 text

@@export_scripts@@ You need to know some APIs

Slide 29

Slide 29 text

@@export_scripts@@ A blank file

Slide 30

Slide 30 text

@@export_scripts@@ Uhh, no tests

Slide 31

Slide 31 text

@@export_scripts@@ Getting stuck

Slide 32

Slide 32 text

@@export_scripts@@ When in doubt, experiment more

Slide 33

Slide 33 text

@@export_scripts@@ Let's riff

Slide 34

Slide 34 text

@@export_scripts@@ Wrap up

Slide 35

Slide 35 text

@@export_scripts@@ Receipts ~6 hours from live sessions youtube.com/@kaspth-final1-psd

Slide 36

Slide 36 text

@@export_scripts@@ How you can start to riff

Slide 37

Slide 37 text

@@export_scripts@@ Pick out UI you like ex. Overcast settings, GitHub sponsors

Slide 38

Slide 38 text

@@export_scripts@@ Start with a coworker

Slide 39

Slide 39 text

@@export_scripts@@ Team leads write up a prompt – ask team to riff for 30 min – compare –

Slide 40

Slide 40 text

@@export_scripts@@ Cheap to run so it's never a loss

Slide 41

Slide 41 text

@@export_scripts@@ One more thing: make it executable require "bundler/inline"; gemfile do gem "activerecord", require: "active_record" gem "sqlite3" end ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" ActiveRecord::Base.logger = Logger.new STDOUT ActiveRecord::Schema.define do create_table :users create_table :posts do |t| t.references :user, null: false, index: true t.string :title, null: false end end class User < ActiveRecord::Base has_many :posts end class Post < ActiveRecord::Base belongs_to :user end user = User.create! post = Post.create! user:, title: "First" binding.irb

Slide 42

Slide 42 text

@@export_scripts@@ Hack Day 10am-noon Oaken 2pm-4pm We riff on your thing

Slide 43

Slide 43 text

@@export_scripts@@ Taking Rails further active_record- associated_object active_job- performs … active_record- ingress action_controller- stashed_redirects Bullet Train nice_partials showcase-rails Experimental brb-templates hercule-poro

Slide 44

Slide 44 text

@@export_scripts@@ Work with me →→→ [email protected] github.com/kaspth twitter.com/kaspth ruby.social/@kaspth