Forum: Ruby on Rails Which one is best for debugging (Pry or Ruby Debug) ?

Posted by fahim patel (fahim_patel)
on 2012-10-12 12:23
(Received via mailing list)
Hi all

I study and understand both the gem , now i am confuse which is one 
best.

Let me know which one is best for debugging ?
Is either Pry or Ruby Debug  ?
Also explain advantage of your selected gem  ?


Thanks

Regards
Fahim Babar Patel
Posted by Norbert Melzer (Guest)
on 2012-10-12 15:49
(Received via mailing list)
As far as I understood the differences ruby debug just sends you to irb,
while pry sends you to the pry console which has syntax highlight, code
completion and other sugar. But I am not aware of the differences in how 
to
use them because I use neither.

Also as far as I know ruby debug doesn't work with ruby 1.9, bit pry 
does.
Am 12.10.2012 12:22 schrieb "Fahim Patel" <pafahim@gmail.com>:
Posted by fahim patel (fahim_patel)
on 2012-10-12 17:14
(Received via mailing list)
Thanks for reply.

Still can u tell me which one is best for debuging....

Bye
Posted by Jordon Bedwell (Guest)
on 2012-10-12 17:20
(Received via mailing list)
Hi,

On Fri, Oct 12, 2012 at 5:22 AM, Fahim Patel <pafahim@gmail.com> wrote:
> Let me know which one is best for debugging ?

Pry is a cross-over REPL (IMO) that replaces IRB and not Ruby
Debugger. I say it's cross-over because it supports some of what Ruby
Debugger does with addons and sometimes even built and also supports
all of what IRB does with some enhancements such as tab completion,
code spacing and syntax highlighting as well as supporting an easy way
to tap into an object with an REPL easily.  There are also other
things like the ability to show the source of a class, a method and
source around where you are (if you are in a method.)

> Is either Pry or Ruby Debug  ?

It's too much to compare Pry to Ruby Debugger because nothing can
replace Ruby Debugger in some cases but if you were throw Pry against
IRB for pure Ruby code it's going to be Pry all the way IMNSHO.

Nothing beats throwing binding.pry in the middle of everything and
figuring out what's going on from a "live" server, such as times when
something is going wrong in a model or controller or a decorator I
will throw a binding.pry in there and visit the page and follow the
tracks all the way down the line until I run into that line that is
causing the problem and then test what fixes it, write a test and fix
the code with the edit command and go on about my day.

> Also explain advantage of your selected gem  ?

That's something you have to figure out for yourself but I listed some 
above.
Posted by fahim patel (fahim_patel)
on 2012-10-12 17:34
(Received via mailing list)
On Friday, October 12, 2012 8:49:23 PM UTC+5:30, Jordon Bedwell wrote:
> all of what IRB does with some enhancements such as tab completion,
>
> Nothing beats throwing binding.pry in the middle of everything and
> figuring out what's going on from a "live" server, such as times when
> something is going wrong in a model or controller or a decorator I
> will throw a binding.pry in there and visit the page and follow the
> tracks all the way down the line until I run into that line that is
> causing the problem and then test what fixes it, write a test and fix
> the code with the edit command and go on about my day.
>

As we use binding.pry , but we use same debugger in ruby debugger.
And as per my knowledge debugger do same thing as binding.pry.If not 
than
explain ?
Posted by Jordon Bedwell (Guest)
on 2012-10-12 17:49
(Received via mailing list)
On Friday, 12 October 2012 10:33:05 UTC-5, Fahim Patel wrote:
>
> As we use binding.pry , but we use same debugger in ruby debugger.
> And as per my knowledge debugger do same thing as binding.pry.If not than
> explain ?
>

They do.  But there is a distinction in that one's only goal is to 
debug,
the other is a cross-over tool who is stuck between deciding on if it's 
a
REPL or a debugger.  By nature it has debugging tools but by theory it's
just a more advanced way to test concepts without needing to jump in and
out of the terminal (unless you use VI or other) to test ideas.

Most at #pry will probably not deny that Pry is a Debugger just as they
will most probably not deny that Pry is a REPL which makes it a tranny 
(I
had to) cross-over tool.  I remember Banister working hard to bring more
debugging tools into Pry but I haven't talked to him for a while so I 
don't
know if that's still the case.

So to address your question, I prefer Pry 90% of the time, I test all my
concept code in Pry before writing it so I can work out pieces of the 
idea
and make sure they are as bug free as possible without full testing, I 
also
use it to debug pieces of code.  So hopefully this explains what I mean.
Posted by fahim patel (fahim_patel)
on 2012-10-12 17:56
(Received via mailing list)
On Friday, October 12, 2012 9:18:57 PM UTC+5:30, Jordon Bedwell wrote:
> REPL or a debugger.  By nature it has debugging tools but by theory it's
> concept code in Pry before writing it so I can work out pieces of the idea
> and make sure they are as bug free as possible without full testing, I also
> use it to debug pieces of code.  So hopefully this explains what I mean.
>

Thanks thanks lot for reply.....
i will use pry now.
But one question raised when  u used this lines, which as follows :-
1.   Pry is a REPL
2.   cross-over tool

What this lines means.

Regards
Fahim Babar Patel
Posted by fahim patel (fahim_patel)
on 2012-10-12 18:01
(Received via mailing list)
I read article about REPL, i understood.

But what your cross over tool lines says.....?
Posted by Jordon Bedwell (Guest)
on 2012-10-12 18:02
(Received via mailing list)
On Friday, 12 October 2012 10:55:58 UTC-5, Fahim Patel wrote:
>
> 1.   Pry is a REPL
> 2.   cross-over tool
> What this lines means.
>

1.) Read-eval-print loop, 2.) Stolen from car marketing (though I have 
no
idea if it originates there), basically a cross-over was a mix between 
an
SUV/Minivan and a car.  In this case Pry is the cross-over it's a mix
between an REPL and debugger.
Posted by fahim patel (fahim_patel)
on 2012-10-12 18:10
(Received via mailing list)
Did u have any knowledge related to any deployment tool.
Posted by Colin Law (Guest)
on 2012-10-12 18:47
(Received via mailing list)
On 12 October 2012 16:48, Jordon Bedwell <envygeeks@gmail.com> wrote:
> just a more advanced way to test concepts without needing to jump in and out
> and make sure they are as bug free as possible without full testing, I also
> use it to debug pieces of code.  So hopefully this explains what I mean.

Jordan, thanks for all the info on pry, I have been contemplating
giving it a go and your posts have encouraged me to get on with it.

Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.