2 ms·
> Debugging with pry is annoying for complex inputs Debugging for complex inputs is always hard, but I’ve yet to see a language do it better than Ruby/pry. Wri
by rco8786 4y ago
> Debugging with pry is annoying for complex inputs
Debugging for complex inputs is always hard, but I’ve yet to see a language do it better than Ruby/pry. Write a test that sets up your complex input, slap a pry in it, use the repl to debug/explore/iterate, then leave the test in place when you’re done.
- itake 4y agoGo forces you to use dependency injection, which makes it much easier to have simple structs (objects). With Ruby (and specifically Rails), so much state is tacked onto ActiveRecord that its difficult to mock/debug apis. For example, calling `#find()` creates a new object or trying to stub out `User::ActiveRecord_Relation` in tests is frustrating.
- rco8786 4y agoAh yea, ActiveRecord has some cruft like that for sure. That’s probably why it’s so common to use an actual database for testing and mocking data. Which has its own set of benefits/drawbacks.