Kyle d'Oliveira
👤 PersonAppearances Over Time
Podcast Appearances
And so if we wanted to see what happens if there is tens of thousands of something in a table or more, we could just build little scripts that can seed that database and then test it outside of production.
And so if we wanted to see what happens if there is tens of thousands of something in a table or more, we could just build little scripts that can seed that database and then test it outside of production.
It's not perfect because it doesn't always match the same shape as production, but it's an iterative process and that information gets codified so you can keep adding to the seeds in those manner so that it becomes a better and better representation as we go forward.
It's not perfect because it doesn't always match the same shape as production, but it's an iterative process and that information gets codified so you can keep adding to the seeds in those manner so that it becomes a better and better representation as we go forward.
Yeah, metaprogramming is actually one of the best strengths of Ruby. You can do so much with it, but once you have it, it's the hammer and everything is a nail and you want to use it. And that's often a trap that new developers, when they learn about metaprogramming, they really want to go into.
Yeah, metaprogramming is actually one of the best strengths of Ruby. You can do so much with it, but once you have it, it's the hammer and everything is a nail and you want to use it. And that's often a trap that new developers, when they learn about metaprogramming, they really want to go into.
I think a good lesson to come out of that story is that if you think about code, it's written once but read countless times. And so if you can take little things to optimize the code for the reader, that is much better than sacrificing readability to optimize for the writer.
I think a good lesson to come out of that story is that if you think about code, it's written once but read countless times. And so if you can take little things to optimize the code for the reader, that is much better than sacrificing readability to optimize for the writer.
So if it takes you an extra 30 minutes to write a whole bunch of cookie cutter methods, but now those methods are in place and they're static and it's easy to read and reason about and test, that is well worth that 30 minutes because you're going to lose more than that reading that piece of code in the future.
So if it takes you an extra 30 minutes to write a whole bunch of cookie cutter methods, but now those methods are in place and they're static and it's easy to read and reason about and test, that is well worth that 30 minutes because you're going to lose more than that reading that piece of code in the future.
Yeah, absolutely. Anything that you can do to make those kind of classes easier to understand and read for a new person is great. And also just backing up a little bit to your example, this is also an instance where metaprogramming bit you, but metaprogramming is also interesting that it could save you because you can also ask Ruby about Ruby.
Yeah, absolutely. Anything that you can do to make those kind of classes easier to understand and read for a new person is great. And also just backing up a little bit to your example, this is also an instance where metaprogramming bit you, but metaprogramming is also interesting that it could save you because you can also ask Ruby about Ruby.
So if anyone didn't know, this is a tactic that I use all the time for debugging pieces of code that I've never been familiar with. If you can have access to a console, you can ask Ruby what methods are available with a .methods call. You can also get access to the method itself and then ask it, what is its source? Where does it live?
So if anyone didn't know, this is a tactic that I use all the time for debugging pieces of code that I've never been familiar with. If you can have access to a console, you can ask Ruby what methods are available with a .methods call. You can also get access to the method itself and then ask it, what is its source? Where does it live?
make life easier to track down methods that may be dynamic or created by gems.
make life easier to track down methods that may be dynamic or created by gems.
I think that's another example of someone making some tooling that makes something that, yeah, if you knew to call .methods and subtract object.new.methods or object.methods, it's great, but now it's two characters, and it's nice and easy, and it's much more approachable, and you can have access to things that you may not knew existed.
I think that's another example of someone making some tooling that makes something that, yeah, if you knew to call .methods and subtract object.new.methods or object.methods, it's great, but now it's two characters, and it's nice and easy, and it's much more approachable, and you can have access to things that you may not knew existed.
Oh, most of my career has been working with Rails. So before Rails 0, I was working at an enterprise Java shop that I don't remember a lot of the details of it anymore. It's kind of too far in the past. But I think I've been working with Rails now for 11 years, I think. So it's been just a long time with just Rails. I don't remember a lot of the pre-Rails world, to be honest.
Oh, most of my career has been working with Rails. So before Rails 0, I was working at an enterprise Java shop that I don't remember a lot of the details of it anymore. It's kind of too far in the past. But I think I've been working with Rails now for 11 years, I think. So it's been just a long time with just Rails. I don't remember a lot of the pre-Rails world, to be honest.