Debugging advice


#1

Can anyone recommend a nice way to debug a rails app, ie to step through
the code, seeing what all the local values are as we go along? Is there
any IDE support? I’m a windows xp user. thanks…


#2

On Aug 1, 2007, at 12:50 PM, Max W. wrote:

Can anyone recommend a nice way to debug a rails app, ie to step
through the code, seeing what all the local values are as we go
along? Is there any IDE support? I’m a windows xp user. thanks…

http://www.google.com/search?q=debug+rails+app

http://www.google.com/search?q=debug+rails+app+ide

-faisal


#3

ruby-debug

On 8/1/07, Max W. removed_email_address@domain.invalid wrote:

Can anyone recommend a nice way to debug a rails app, ie to step through
the code, seeing what all the local values are as we go along? Is there
any IDE support? I’m a windows xp user. thanks…

Posted via http://www.ruby-forum.com/.


Cheers!


#4

Yep. Download last eclipse basic edition. Eclipse Europe
Then download radrails plugin in www.aptana.org

Create a new server in debug mode with your existing rails app and you
will
have debugging options (breakpoints, watch variables…)


#5

Luis V. wrote:

Yep. Download last eclipse basic edition. Eclipse Europe
Then download radrails plugin in www.aptana.org

Create a new server in debug mode with your existing rails app and you
will
have debugging options (breakpoints, watch variables…)

Thanks for the advice Luis - another question for you: Eclipse seems to
have a few different versions - do i just get the latest Eclipse “Java
Developers” edition? looking at the Europa “21 projects” list and
feeling a bit unsure.

cheers


#6

Sorry I told you basic edition. I meant Classic Edition.


#7

Faisal N Jawdat wrote:

On Aug 1, 2007, at 12:50 PM, Max W. wrote:

Can anyone recommend a nice way to debug a rails app, ie to step
through the code, seeing what all the local values are as we go
along? Is there any IDE support? I’m a windows xp user. thanks…

http://www.google.com/search?q=debug+rails+app

http://www.google.com/search?q=debug+rails+app+ide

-faisal

I know that google is my friend etc, i was hoping for a recommendation
of a particular IDE? Anyone?

Thanks anyway, don’t mean to sound ungrateful :slight_smile:


#8

Max W. wrote:

I know that google is my friend etc, i was hoping for a recommendation
of a particular IDE? Anyone?

The beta version of NetBeans 6.0 is free, open source and has great Ruby
on Rails support. For Ruby specifc build see
http://wiki.netbeans.org/wiki/view/Ruby it supports breakpoint
debugging, code completion etc… For screen shots and examples check
out the developers blog at http://blogs.sun.com/tor/

I prefer NetBeans over Eclipse (although Eclipse is certainly good) so
make sure you try them both. Either way the IDE environment fro Ruby and
specifically Rails is improving in leaps and bounds at a rapid pace.

Cheers,

Anthony


#9

Max W. wrote:

Luis V. wrote:

Yep. Download last eclipse basic edition. Eclipse Europe
Then download radrails plugin in www.aptana.org

Create a new server in debug mode with your existing rails app and you
will
have debugging options (breakpoints, watch variables…)

Thanks for the advice Luis - another question for you: Eclipse seems to
have a few different versions - do i just get the latest Eclipse “Java
Developers” edition? looking at the Europa “21 projects” list and
feeling a bit unsure.

cheers

Never mind! Found all the installation instructions on the aptana site.
cheers! :slight_smile:


#10

On Wed, Aug 01, 2007 at 06:50:52PM +0200, Max W. wrote:

Can anyone recommend a nice way to debug a rails app, ie to step through
the code, seeing what all the local values are as we go along? Is there
any IDE support? I’m a windows xp user. thanks…

By far the nicest way to debug a rails app is to write more Tests :slight_smile:

You really should not need to step through your code with a debugger
since your test cases should show you where the bug is. Just do in your
unit/functional tests what you would otherwise do manually in your
debugging UI - compare the real values of variables to what you would
expect them to be.

cheers,
Jens


Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/ - The new free film database


#11

Jens K. wrote:

By far the nicest way to debug a rails app is to write more Tests :slight_smile:
You really should not need to step through your code with a debugger
since your test cases should show you where the bug is. Just do in your
unit/functional tests what you would otherwise do manually in your
debugging UI - compare the real values of variables to what you would
expect them to be.

I must admit to never have used the debugger for tracking down a bug, I
find the stack dump or development log to contain the information
required (so far). What I find the debugger great for is just learning
how rails works better, nothing like stepping through the code as it
runs to see what is happening.

– Anthony


#12

Debugging and unit testing are to different methods to achieve more
flawless application.

The unit testing can be expressed like snapshot checking.
You bring your app in some state, than take a snapshot and compare the
snapshot taken with expected one.
Debugging is more like flow checking. You start your ride at some
point of execution and enjoy, more or less, the way your program is
taking you.

Both techniques are required.
The unit testing will tell you if your program is on the right state
on every checkpoint.
Debugger can find the paths that are not covered by unit testing.

Since this is about the IDE, I personally use Eclipse (Europa) with
Aptana using rails-debug.
Some times it is convenient to debug from console but it’s up to you.

End for the closing it is essential to learn to read the log files and
to use logging as much as possible since some issues are hard to
reproduce.


#13

On Aug 2, 3:54 pm, Jens K. removed_email_address@domain.invalid wrote:

unit/functional tests what you would otherwise do manually in your
debugging UI - compare the real values of variables to what you would
expect them to be.

That is the best piece of advice IMO. Though others have pointed out
that debugging is good way to learn the flow etc.
the real practical advice is to have a thorough coverage of test cases
for the entire application.


Procrastinx