首页计算机计算机基础计算机专业英语 05-4 5.4 Program Debugging and Program Maintenance.pptx

05-4 5.4 Program Debugging and Program Maintenance.pptx

页数:19页文件大小:99.5 KB来源: 计算机专业英语ppt课件

本课件对应5.4 Program Debugging and Program Maintenance(程序调试与维护)一节,介绍语法错误与逻辑错误的排查方法,说明程序测试、文档编写与后期维护的常规做法。课文配中英文对照译文、生词短语表与课后练习,可用于课堂讲授与课前预习。

5.4 Program Debugging and Program Maintenance 生词表页,收录 abnormal、abreast、array 等8个专业词汇的词性与中文释义
5.4 Program Debugging and Program Maintenance 生词表页,收录 Dbx、debug、lt;俗>除错,改正有毛病部分 等9个专业词汇的词性与中文释义
5.4 Program Debugging and Program Maintenance 生词表页,收录 primitive、rigorous、scatter 等10个专业词汇的词性与中文释义
查看本课件的文字版(共 19 页,供检索与复制)

第1页:5.4 生词表

5.4 Program Debugging and Program Maintenance 生词表
单词词性中文释义
abnormaladj.反常的,变态的
abreastadv.并肩地,并排地
arrayn.排列
v.部署,排列assignv.分配,指派
v.赋值beyondprep.在(到)……较远的一边,超过
adv.在远处bugn.程序缺陷,电脑系统的问题,臭虫
capturen.捕获
v.捕获consultantn.顾问,咨询者

第2页:5.4 生词表(续)

5.4 Program Debugging and Program Maintenance 生词表
单词词性中文释义
Dbxn.一种调试运行源程序的工具
debugv.<俗&
lt;俗>除错,改正有毛病部分n.调试,调试工具
effortn.努力,成就
ensurev.确保,保证Gdb一种项目调试器,用来观察程序的执行过程
Gdb一种项目调试器,用来观察程序的执行过程handyadj.手边的,容易取得的
issuen.出版,论点,问题,
v.使流出,发行(钞票等)Sabern.一种C调试程序用来找出程序中的错误,有良好的在线帮助系统
adj.必要的,必然的pointern.指示器

第3页:5.4 生词表(续)

5.4 Program Debugging and Program Maintenance 生词表
单词词性中文释义
primitiveadj.原始的,简单的
rigorousadj.严格的
scatterv.分散
seriousadj.严肃的,认真的,严重的
sophisticaten.精于……之道的人
v.弄复杂;诡辩stockn.库存
adj.常备的,存货的subscriptadj.写在下方的
syntacticaladj.[语]依照句法的
threatenv.恐吓,威胁,可能来临
tipn.提示

第4页:5.4 缩略语表

5.4 Program Debugging and Program Maintenance 缩略语表
缩写英文全称中文含义
OLCOnline Learning Center在线学习中心

第5页:如果你的程序非正常退出

5.4 Program Debugging and Program Maintenance程序调试与维护

If your program exits abnormally, then there is almost certainly a logical error (abug)in your program. 99%of programming is finding and removing these bugs. Herearesome tips to help you get started.

如果你的程序非正常退出,很有可能你的程序中有逻辑错误(或称之bug)。99%的程序工作是要找出并去除这些bug。下面是对一些初学者的提示。

第6页:5.4 程序调试与维护 课文要点

Beforegoingon,it is necessary to reiterate the standard OLCpolicyon program debugging:Do*NOT*ask OLCforhelp debugging a program.[1]This stock answer is intended to give you some tips on how to get started in this area;however,ingeneral,program debugging requires more time and effort than consultants are usually able to provide.分析:本句是并列句,however连接表示转折意义的两个分句。后一个分句中than consultants are usually able to provide为than引导的比较状语从句, than在状语从句中充当provide的宾语。类似的句子有:John’s father seldom spent on his son as much as was necessary…Mark was delighted to see his new flat was larger than I expect…上面的两个句子中,“as”和“than”分别充当了从句的主语和宾语。

首先,有必要重复关于程序调试的标准OLC规则:不要请求OLC帮助调试程序。这种预存的答案用来给出一些关于在这一领域怎样开始的提示。但总的来说,程序调试需要的时间和努力比咨询者通常所能提供的更多。

第7页:第一步

第一步是找出程序出错的精确的语句行。实现的方法是在程序代码中分散布置一些打印语句。例如,你可以在源程序中做如下工作:(略)

The first step is to find the exact line where the program exits. Onewayof doing this is with print statements scattered through your code. Forexample, you might do something like this in your sourcecode: my plot (intx, inty){printf ("Enteringmyp lot ()\n"); fflush (stdout);----lots of code here------printf ("Exitingmyp lot ()\n"); fflush (stdout); return;}

第8页:C语言中的fflush()命令使得输出立

C语言中的fflush()命令使得输出立即被送到显示器上,如果你为了调试而使用printf(),就要用到fflush()。

Thefflush ()command in Censuresthat the print statement is sent to your screen immediately, and you should use it if you're using printf ()for debugging purposes.

第9页:引导的条件状语从句

[2]Onceyouhave narrowed down the line where your bug occurs,the next step is to find out the value of your variables at that time. You will probably find that one of your variables contains very strange values. This is the time to check that you have not done the following thingsAssigned an integer value to a pointer variable;orWritten to a subscript that is beyond the end of an array(remember that in Carraysub scripts go from 0 to N-1,notfrom1toN).本句是复合句。这里“once”引导的条件状语从句,意为“一旦……”。主句中不定式短语to find out the value of yourvaluables at that time作is的表语。一旦缩小了编程错误存在的范围,下一步就是要找出当时的变量值。你可能会发现某个变量值很奇怪。这时候就要检查你有没有做下面的事情:给指针变量赋予一个整数值;或者数组的下标越界。(记住,C数组的下标是从0到N-1,不是从1到N。)

第10页:使用printf()

使用printf()是调试程序最原始的方法,但有时却是惟一有效的方法。如果你的程序对一个调试器(如Saber或Dbx)来说太大,或者你使用的是非Athena平台,你可能没有合适的调试器。通常,使用调试器会更快更容易。Athena有几个好用的调试工具,Saber是C程序员的工具选择。Gdb和Dbx使用也很方便,并且都适用于Fortran和C。有许多介绍Saber和Dbx的现成答案,Saber甚至还有辅导材料。

Usingprintf ()is a primitive method of debugging, but sometimes it's the only one that will work. If your program is too big for a debugger (such as Saberor Ddbx)or if you are working on an on-Athena platform, you may not have a debugger available. Usually, though, it is quicker and easier to use a debugger. Athenahas several sophisticated debugging tools available. Saberisthe tool of choice for Cprogrammers. Gdband Dbxmayalso come in handy, and both of them work with Fortranas well as with C. There are stock answers that introduce Saberand Dbx, and Sabereven comes with a tutorial.

第11页:别的错误也会引起bug

别的错误也会引起bug,例如要确认循环测试的边界条件使用正确。其他类型的bug(程序不终止,错误输出)用同样的方法进行调试。再一次找到第一个错误发生的行,检查变量值。当你处理了一个bug后,重新编译程序,再次运行。如果需要还要再调试。

Other mistakes also cause bugs. Makesurethat your loops test correctly for their end conditions, forexample. Otherkindsof bugs (programs not exiting, incorrect output)are debugged using similar methods. Again, find the line where the first error occurs, and then check the values of your variables. Onceyoufixa bug, recompile your program, run it again, and the ndebugit again as necessary.

第12页:程序设计中有这样的情况

程序设计中有这样的情况,就是好像永远有一个bug或错误有待改正。错误大体分为:语法错误——这一类错误出现在表示算法的语言中。

Itisafactof life in program design but there seems to be always one last bugor error to be corrected. Wecanbroadly classify the errors as:Syntaxerrors—this class of error means that a mistake is made in the language used to state the algorithm.

第13页:表示算法的语法

逻辑错误——表示算法的语法是正确的,但得不到预期结果。数据范围和数据类型错误——算法的语法和逻辑都正确,但是有错误数据类型或超出范围的数据值对程序造成威胁。Logicerrors—the algorithm is syntactically correct but doesn't do what is intended.Datarangeand datatype errors—the algorithm is syntactically correct and logically correct but can be threatened by the wrong kind of data or by values which are out of range.

第14页:5.4 程序调试与维护 课文要点

[3]The syntax errors aren't a serious issue during the program design phase since in practice,after designing and testing the design,the program will be implemented in a computer program language and it is at this point that syntax errors become a problem. Evensosyntax errors area minor problem since the process of building the program will capture the errors. The program simply won't build until all the syntax errors are removed.分析:本句是复合句。在since引导的原因状语从句中,it is at this point that syntax errors become a problem为强调句。强调句句型结构为:It+be+被强调成分+that/who…。通过这种结构可以强调除谓语动词以外的大多数句子成分。

程序设计阶段,语法错误不是一个严重问题,因为在实际应用中,当设计完成并测试后,要用某一种计算机语言实现程序,这时语法错误才成为需要处理的问题。但即使这样,语法错误也是小问题,因为在程序组建阶段会发现错误。只有语法错误清除后才能组建程序。

第15页:逻辑错误是较为严重的问题

逻辑错误是较为严重的问题,因为没有办法可消除逻辑错误,除非彻底测试程序设计

数据错误也是严重错误,有时比逻辑错误更难处理。

The logic errors area much more serious problem since there is no way to eliminate these other than rigorously testing the program design.

The data errors are also serious errors and in some respects are harder to deal with than logic errors.

第16页:投入使用后

投入使用后,程序需要维护。程序维护的定义就是根据机构的需要或硬件、软件改变的情况不断地更新程序。基于要实现的维护任务,程序管理员需要决定后续经济支持和人员需要及配备。程序维护是应用程序总体花费中的主要部分。

Once launched, the program needs to be maintained. Definition for program maintenance is that updating programs from time to time keeps abreast of changes in an organization's needs or its hardware and software. Based on the maintenance tasks needed to be performed, the program administrators should determine on-going financial and staffing needs and how they will be met. Program maintenance represents a major portion of the total expenditures on application programs.

第17页:习题5.4 一 判断正误

习题5.4 一 判断正误:根据课文内容判断下列说法正误。

Put“true”or“false”in the brackets for the following statements according to the passage.

  1. ()Ifaprogramex its abnormally, then there is almost certainly a logical error (abug)in the program.
  2. ()The first step of debugging is to find the exact line where the program exits.
  3. ()Onewayof debugging a program is with print statements scattered through the code.
  4. ()Onceyouhave narrowed down the line where your bug occurs, the next step is to find out the value of your variables at that time.
  5. ()In Carraysub scripts go from 1 to N.
  6. ()Usingprintfs ()is a primitive method of debugging.
  7. ()Wecanbroadly classify the errors as: Syntaxerrors, Logicerrors, Datarangeand datatype errors.

第18页:习题5.4 二 练习

习题5.4 二 练习:根据课文内容完成下列练习。

Fillinthe blanks according to the passage.

  1. Whenyouwrite a Cprogram, you cannot assign_________________value to a pointer variable.
  2. There seems to be always one last_________________or error to be corrected.
  3. Syntaxerrors means that a mistake is made in the_________________used to state the algorithm.
  4. Once launched, the program needs to be_________________.
  5. Program maintenance represents a_________________portion of the total expenditures on application programs.
  6. The logic errors area much more_________________problem.
  7. Usually, it is quicker and easier to use a_________________.
  8. Usingprintf ()isa_________________method of debugging, but sometimes it’s the only one that will_________________.

第19页:习题5.4 三 翻译

习题5.4 三 翻译:将下列单词和短语译成中文。

Translate the following words and expressions into Chinese.

  1. necessary
  2. check
  3. choice
  4. tutorial
  5. broadly
  6. exact
  7. platform
  8. algorithm
  9. implement
  10. expenditure

《计算机专业英语》课件目录

顶部目录