Discover this podcast and so much more

Podcasts are free to enjoy without a subscription. We also offer ebooks, audiobooks, and so much more for just $11.99/month.

358: Class Methods

358: Class Methods

FromThe Bike Shed


358: Class Methods

FromThe Bike Shed

ratings:
Length:
41 minutes
Released:
Oct 18, 2022
Format:
Podcast episode

Description

Inspired by a Slack thread, Joël invites fellow thoughtbotter Aji Slater on the show to talk about when you should use class methods and when you should avoid them. Are there particular anti-patterns to look out for? How does this fit in with good object-oriented programming? What about Rails? What is an "alternate constructor"? What about service objects? So many questions, and friends, they deliver!
Backbone.js collections (https://backbonejs.org/#Model-Collections)
Query object (https://thoughtbot.com/blog/a-case-for-query-objects-in-rails)
Rails is a dialect (https://solnic.codes/2022/02/02/rails-and-its-ruby-dialect/)
Meditations on a Class Method (https://thoughtbot.com/blog/meditations-on-a-class-method)
Why Ruby Class Methods Resist Refactoring (https://codeclimate.com/blog/why-ruby-class-methods-resist-refactoring/)
Transcript:
JOËL: Hello and welcome to another episode of The Bike Shed, a weekly podcast from your friends at thoughtbot about developing great software. I'm Joël Quenneville. And today, I'm joined by fellow thoughtboter Aji Slater.
AJI: Howdy.
JOËL: And together, we're here to share a little bit of what we've learned along the way. So, Aji, what's new in your world?
AJI: Yeah, well, I just joined a new project, so that's kind of the newest thing in my day-to-day work world. I say just joined, but I guess it was about a month ago now. I'm on the Liftoff team at thoughtbot, which is different than the team that you're on. We do more closer to greenfield ideas and things like that. So there's actually not much to speak about there in that project just yet. Rails new is still just over the horizon for us.
So I've been putting a lot of unused brain cycles toward a side project that is sort of a personal knowledge base concept, and that's a whole thing that I could probably host an entire podcast about. So we don't have to go too deep into my theories about that. But suffice it to say I've talked to some other ADHDers like myself who find that that space is not really conducive to the way that we think and have to organize ourselves and our personal knowledge stores. So sort of writing an app that can lend itself to our fast brains a little bit better.
JOËL: Nice. I just recently recorded an episode of this podcast talking a little bit about note-taking approaches and knowledge-base systems. So, yeah, it's a topic that's very much top of mind for me right now.
AJI: Yeah, what else is going on in your world?
JOËL: I'm based in New England in the U.S. East Coast, and it is fall here. I feel like it happened kind of all of a sudden. And the traditional fall thing to do here is to go to an orchard and pick apples. It's a fun activity to do, and so I'm in the middle of planning that. Yeah, it's fun to go out into nature, very artificial space.
AJI: [laughs]
JOËL: But it's a fun thing to do every fall.
AJI: Yeah, we do that here too. There's an orchard up north of us where my wife and I live in Chicago that we try to visit. And Apple Fest in Lincoln Square is this weekend, and we've been really looking forward to that. Try another time at making homemade hard cider this season, I think, and see how that goes.
JOËL: Fun. When you say another time, does that mean there was a previous unsuccessful attempt?
AJI: Yes. Did the sort of naive approach to it, and there is apparently a lot more subtlety to cidermaking than there is home-brew beer. And we got some real strong funk in that cider that did not make it necessarily an enjoyable experience. Like, it worked but wasn't the tastiest.
JOËL: So it got alcoholic. It was just terrible to drink.
AJI: Yeah, I would back that up.
JOËL: So recently, at thoughtbot, we had a conversation among different team members about the use of Ruby class methods, when they make sense, when they are to be avoided. What is their use case? And different people had different opinions. So I'm curious what your take on class methods are. When do you like to use them?
AJI: Yeah, I remember those
Released:
Oct 18, 2022
Format:
Podcast episode

Titles in the series (100)

On The Bike Shed, hosts Chris Toomey and Steph Viccari discuss their development experience and challenges with Ruby, Rails, JavaScript, and whatever else is drawing their attention, admiration, or ire this week.