Ryan Bates

14.3K posts

Ryan Bates banner
Ryan Bates

Ryan Bates

@rbates

Producer of RailsCasts - Ruby on Rails Screencasts

Southern Oregon Katılım Mart 2008
479 Takip Edilen38.5K Takipçiler
Sabitlenmiş Tweet
Ryan Bates
Ryan Bates@rbates·
I finally set up a Bluesky account. You can find me at bsky.app/profile/rbates… I'll continue to post on Twitter/X as well.
English
2
0
10
3K
Ryan Bates
Ryan Bates@rbates·
I no longer recommend DigitalOcean for hosting. They pulled the rug out from under me. RailsCasts has moved back to @linode.
English
29
37
261
0
Chris Oliver
Chris Oliver@excid3·
Fantastic email to wake up to from @stripe! 🎉 I purchased onemonth.com (where I used to work) a few months ago and have been working on relaunching it.
Chris Oliver tweet media
English
10
0
103
10.5K
Ryan Bates
Ryan Bates@rbates·
What an awesome little game Replicube is. It’s like Picross 3D meets shader programming. The puzzles are a fun challenge and the interface is charming. Thanks @walaber! walaber.com/replicube
English
0
0
9
2.6K
Ryan Bates
Ryan Bates@rbates·
@xymbol @pragdave That’s a great article, thanks for sharing. I basically code in a similar style that Dave does here. Create modules with class methods for the behavior. Use classes/objects as bags of data with minimal logic.
English
0
0
6
422
Ryan Bates
Ryan Bates@rbates·
90% of the Ruby code I’ve written the past few years has been class methods without shared state. The code has clearer dependencies and is easier to read, test and maintain. OOP has its place, but I don’t think it fits the majority of web-app logic.
English
25
7
171
11.2K
Ryan Bates
Ryan Bates@rbates·
@jorgemanru Yeah, I might write up a blog post on the topic sometime.
English
2
0
7
594
Ryan Bates
Ryan Bates@rbates·
@lazaronixon I always use named arguments unless it’s a single argument with the name of it in the method. Most of the time it’s 1-5 args.
English
1
0
1
294
Lázaro Nixon
Lázaro Nixon@lazaronixon·
@rbates Interesting, which kind of parameters do you use? Positional parameters? How many per method?
English
1
0
12
376
Ryan Bates
Ryan Bates@rbates·
@MorriceGavin @ismasan I generally don’t follow the functional core approach. Having a pure method is great, but I don’t go too far out of my way. I find most web apps rely so heavily on the database that a functional core leads to a lot of layers and indirection. I don’t like layers.
English
1
0
1
47
Gavin Morrice
Gavin Morrice@iamtheantislop·
@ismasan @rbates I appreciate that this is more of a functional approach, and that has its strengths. But a lot of these wouldn’t be “pure” functions would they? In the context of a Rails app, you’re still going to be mutating a lot of the arguments passed to these functions?
English
2
0
1
46
Ryan Bates
Ryan Bates@rbates·
@justinamarsh Hard to do on Twitter. I might make a blog post about it some day.
English
0
0
1
260
Ryan Bates
Ryan Bates@rbates·
@MorriceGavin @ismasan Exactly, those dependencies are very clear. You can see what is being called and follow them. It’s also easy to reverse-lookup to see what is calling a given method.
English
0
0
1
22
Gavin Morrice
Gavin Morrice@iamtheantislop·
@rbates @ismasan I understand that part. But then surely you’ll have as many or more hard dependencies in the forms of classes/modules that you are referencing inside your singleton methods? ModuleA.thing ModuleB.other_thing etc?
English
2
0
1
75
Ryan Bates
Ryan Bates@rbates·
@gagsdfhy I should add, if you do pass the same set of arguments around frequently you can put them into a hash or data object.
English
0
0
2
124
Ryan Bates
Ryan Bates@rbates·
@gagsdfhy There is some repetition but it isn’t bad with the Ruby shorthand for named arguments. I thought this would be a bigger issue but it really isn’t.
English
1
0
3
380
Ryan Bates
Ryan Bates@rbates·
@mahdix I’m actually not the greatest fan of functional programming either. I’m fascinated by it but the constraints are a little too much for me. I often find functional code harder to read and follow compared to a more procedural style.
English
1
0
3
458
Mahdi M.
Mahdi M.@mahdix·
@rbates You are on your way to functional programming
English
1
0
10
635
Ryan Bates
Ryan Bates@rbates·
@talent_overflow My reasoning is less about breaking existing code and more about keeping the flow of the code straightforward to read.
English
0
0
1
116
Emir I.
Emir I.@talent_overflow·
@rbates Normally I’d say yes but if you have tests you should be safe to modify for more than one purpose
English
1
0
5
123
Ryan Bates
Ryan Bates@rbates·
Whenever you’re tempted to reuse a method that *almost* does what you want: Stop, duplicate the method, make the modifications, and then refactor the actual duplication.
English
4
7
73
3.7K
Ryan Bates
Ryan Bates@rbates·
I Googled “capybara drag_to” and the results caught me by surprise.
Ryan Bates tweet media
English
0
2
47
2.5K
Ryan Bates
Ryan Bates@rbates·
Anyone else find GitHub code diffs near impossible to use in Safari lately? Slows to a crawl and/or doesn’t render.
English
11
0
22
3.1K
Ryan Bates
Ryan Bates@rbates·
@jnstq Difficult to grep, difficult to read. Harder to track down bugs when they do happen. Overall a maintenance headache.
English
1
0
1
83
Ryan Bates
Ryan Bates@rbates·
Ruby’s metaprogramming is like a forbidden fruit. Always there tempting me, and I almost always regret using it.
English
5
2
75
3.4K