调试像ruby这样的脚本语言 [英] Debugging a scripting language like ruby

查看:159
本文介绍了调试像ruby这样的脚本语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上来自C语言编程领域,现在正在研究Ruby和Python等脚本语言领域.

I am basically from the world of C language programming, now delving into the world of scripting languages like Ruby and Python.

我想知道如何进行调试. 目前,我要遵循的步骤是

I am wondering how to do debugging. At present the steps I follow is,

  • 我完成了一个大脚本,
  • 评论除我以外的所有内容 要检查
  • 执行脚本
  • I complete a large script,
  • Comment everything but the portion I want to check
  • Execute the script

尽管可以工作,但我无法像在VC ++环境中那样调试.

Though it works, I am not able to debug like how I would do in, say, a VC++ environment or something like that.

我的问题是,有没有更好的调试方法?

My question is, is there any better way of debugging?

注意:我想这可能是一个重复的问题,如果是这样,请指出答案.

Note: I guess it may be a repeated question, if so, please point me to the answer.

推荐答案

您的顺序对我来说似乎完全倒退了.这是我的方法:

Your sequence seems entirely backwards to me. Here's how I do it:

  1. 我为所需的功能编写了一个测试.
  2. 我开始编写脚本,执行位并验证测试结果.
  3. 我会审查记录和发布的内容.

具体来说,我在完成之前执行 .到那时太晚了.

Specifically, I execute before I complete. It's way too late by then.

当然有调试器,但是有了良好的测试和良好的设计,我几乎再也不需要调试器了.

There are debuggers, of course, but with good tests and good design, I've almost never needed one.

这篇关于调试像ruby这样的脚本语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆