登陆注册
27082000000034

第34章 Software Engineering(4)

One important feature of top-down design is that at each level the detail of the design at lower levels is hidden. Only the necessary data and control that must be passed back and forth over the interfaces are defined. Furthermore, if a data structure is contained wholly within a lower level module, it need not be specified until that level be reached in the design process. However, if several modules at some level must share data, then the data structure must be chosen before progressing to a lower level. The design will include both the data structure and the means of data access for each module involved.

The bottom-up design starts with analysis of specifications of the key parts, so the feasibility of the design is tested at the early stage. If the design is not feasible under the given specifications and constraints, the requirements are changed and the design proceeds without the danger of incompatible and unrealizable specifications undiscovered until late in the design process. But in bottom-up design, each module is coded as soon as its design is fixed, in contrast with the top-down process.

It is not uncommon to have mixture of top-down and bottom-up design and coding used in a project. It is a good idea to have a top-down design and bottom-up coding, and vice versa.

The structured programming philosophy aims to provide a well-defined, well-formulated and ****** approach to program design. Structured programming requires the use of single-entry and single-exit control structures. The classical technique used to implement these principles is to restrict all control constructs to one of the three statements.

The advantages of structured programming are obvious:

(1) Clarity—structured programs generally have clarity and logical pattern to their control structure which is a tremendous advantage throughout the design process.

(2) Productivity—programmers who use structured techniques show a significant increase in instructions coded per man-hour of work. Similar advantages are claimed for the test phase.

(3) Fixed style—structured programming tends to limit the coding to a few straightforward design approaches. This aids the designer's associates and successors in understanding the design.

(4) Maintenance—the clarity and modularity of a structured design is of great help in localizing an error and redesigning the offending section of code.

(5)Redesign—most large software products are subject to occasional redesign (often called enhancement). The clarity and modularity of structured design maximize the amount of code, which can be reused.

【Vocabulary】

top-down

自顶向下

bottom-up

由底向上

decomposition

n. 分解,腐烂

process

vt. 加工,处理

module

n. 模数,模块

straightforward

adj. 正直的,坦率的,简单的

hidden

adj. 隐藏的

furthermore

adv. 此外,而且

wholly

adv. 整个,统统,全部

specification

n. 详述,规格,说明书

coding

n. 译码

vice

n. 恶习,恶行,罪恶,缺点

philosophy

n. 哲学,哲学体系,冷静

clarity

n. 清楚,透明,明确性

maintenance

n. 维护,保持,可维护性

occasional

adj. 偶然的,临时的,非经常的

modularity

n. 模块性

structure programming

结构化程序设计

【参考译文】

现代软件设计的方法

下面简单论述一下诸如自顶向下程序设计、自底向上程序设计和结构化程序设计的现代软件设计中的一些主题。

自顶向下程序设计基本上是一个重点放在程序的控制流程和控制结构的分解过程。第一步是研究手中任务的各个部分,并将其分解为几个模块(一般是3到10个)。第二步是将模块进一步细分为独立的子模块,这个过程将不断重复直到分解的模块足够小,能够透彻地理解,并能很快地以直接和简单的方式编程。由此形成一个多层逻辑或控制结构,很明显某些模块将扩展到很多层。

自顶向下程序设计的一个重要特征是对每一层而言,其下面层次的详细设计被隐藏起来,只有需要回传及超出接口的必要数据和控制被定义。此外,如果一个数据结构完全属于一个低层模块,设计过程中在到达该层之前不需要对其进行说明。然而当同一层次中的几个模块要共享数据时,在向下一层前进之前就应对数据结构做出选择。设计将包括数据结构和各个模块中涉及访问数据的方法。

自底向上的程序设计从分析关键部分的技术要求开始,因此设计的可行性在早期就被测试。在给定的技术要求和约束条件下,如果设计不可行则需求就必须更改,程序设计也不必承担后期才发现与技术要求互相矛盾或不可实现的风险。但是与自顶向下程序设计过程相比,在自底向上的程序设计中,每个模块的设计一旦确定就可以开始编程了。

在一个项目中,把自顶向下的程序设计和自底向上的程序设计或编程结合在一起是很常见的,而且把自顶向下的程序设计和自底向上的编程结合在一起是一个很不错的方法,反之亦然。

结构化程序设计的指导思想是提供一种定义明确、表达清晰而且简单的程序设计方法。结构化程序设计要求使用单入口和单出口的控制结构,用于贯彻这一要求的经典方法是限制控制结构,只能在三种经典结构中选择一种。

结构化程序设计的优越性是明显的:

(1)明确性——结构化程序通常具有明确性,控制结构合乎逻辑,这在程序设计过程中是一个相当大的优势;

(2)生产效率——使用结构化技术的程序员每人在一小时编写的代码有相当大的增加,相似的优越性在测试阶段也有所体现;

(3)固定的风格——结构化程序设计倾向于把编程限制在一些直截了当的设计方法内,这有助于设计人员的同事或接任者理解他的设计;

(4)可维护性——明确性和模块化对于定位错误和重新设计有缺陷的部分非常有帮助;

(5)重新设计——大部分大型软件产品都会经历一到两次重新设计的过程(通常叫做增强)。

【Reading Material】

Classic Testing Mistakes

When testing, you must decide how to exercise the program, and then do it. The doing is ever so much more interesting than the deciding. A tester's itch to start breaking the program is as strong as a programmer's itch to start writing code -- and it has the same effect: design work is skimped, and quality suffers. Paying more attention to running tests than to designing them is a classic mistake. A tester who is not systematic, who does not spend time laying out the possibilities in advance, will overlook special cases. They may be the same subtle ones that the programmers overlooked.

Concentration on execution also results in un-reviewed test designs. Just like programmers, testers can benefit from a second pair of eyes. Reviews of test designs needn't be as elaborate as product design reviews, but a short check of the testing approach and the resulting tests can find significant omissions at low cost.

What is a test design?

A test design should contain a description of the setup, inputs given to the product, and a description of expected results. One common mistake is being too specific about test inputs and procedures.

Suppose you're testing a banking application. Here are two possible test designs:

Design 1

Setup: initialize the balance in account 12 with $100.

Procedure:

Start the program.

Type 12 in theAccount window.

Press OK.

Click on the 'Withdraw' toolbar button.

In the popup dialog, click on the “all'” button.

Press OK.

Expect to see a confirmation popup that says "You are about to withdraw all the money from this account. Continue?"

Press OK.

Expect to see a 0 balance in the account window.

同类推荐
  • 美丽英文:那些激励我前行的睿思

    美丽英文:那些激励我前行的睿思

    在这里,世界级的大师用发人深省的哲理语言,从不同的角度告诉我们,应如何面对生活、品味情感、看待世间百态、抓住未来的人生。在这里,最重要的不是思想,而是思想的深度。让我们在学习名人的睿智、感受精辟的文字同时,在大师的浩瀚思想之海中痛快徜徉,提升自己的素质和品格,为今后的生活找到正确的指引,一步步走向更好的明天。
  • Stories by English Authors in London

    Stories by English Authors in London

    Frequently I have to ask myself in the street for the name of the man I bowed to just now, and then, before I can answer, the wind of the first corner blows him from my memory.
  • 课外英语-名家名诗欣赏(双语版)

    课外英语-名家名诗欣赏(双语版)

    请别用哀伤的诗句对我讲;人生呵,无非是虚梦一场!因为沉睡的灵魂如死一般,事物的表里并不一样。人生是实在的!人生是热烈的!人生的目标绝不是坟墓;你是尘土,应归于尘土。
  • 课外英语-古诗精选(双语版)

    课外英语-古诗精选(双语版)

    本套书共50册,分为美国各州的小知识,七彩缤纷的音符,优美好看的小散文,开心时分的短文,经典流传的寓言,超级高效的短句,实际有用的词汇等等在这些书中,备有单词解释,相关简介,或中文翻译,便于同学们更好的阅读和理解,真正进入文字的内涵当中,准确地和文字进行交流。本书主要讲五言古诗及七言律诗。
  • 课外英语-七彩音符时不我待(双语版)

    课外英语-七彩音符时不我待(双语版)

    本书收录了世界经典英文歌曲,其中包括常青的爱、昔日恋情、无心快语、克莱门泰等多首脍炙人口的歌曲,每首歌曲都有中英文歌词、语言点解析及注释赏析。
热门推荐
  • 许你一生一世缘

    许你一生一世缘

    重生后,她看着眼前疼她入骨又矜贵冷魅的老公,一度怀疑当初自己心瞎眼盲,竟然任性妄为作天作地一再推开他,甚至多次和他提出了离婚!前世,她因另有所爱,偏听偏信,终是蒙冤入狱,含恨而终,也害惨了对她用情至深的老公。重过一世,她势必擦亮眼睛,远离渣男,手刃仇人。而且,今生,她再也不会犯傻,要紧紧抱着老公的大腿,“老公,我想待在你身边,天天都陪着你。”好好爱她曾经亏欠了一辈子的老公。
  • 天行

    天行

    号称“北辰骑神”的天才玩家以自创的“牧马冲锋流”战术击败了国服第一弓手北冥雪,被誉为天纵战榜第一骑士的他,却受到小人排挤,最终离开了效力已久的银狐俱乐部。是沉沦,还是再次崛起?恰逢其时,月恒集团第四款游戏“天行”正式上线,虚拟世界再起风云!
  • 厨医男神

    厨医男神

    快乐不起来,悲伤不下去,柳寒的生活状态就是亚健康。男神学生遭遇男神经老师,演绎疯狂快乐的征程。
  • 全能影后超级甜

    全能影后超级甜

    十八线艺人宁肜肜画风突变变成变换大师。王牌资源?手到擒来。影帝影后?上门合作。巨鳄大佬?默默提携。你问她为什么没有追求者?陆城霄在背后给她小钱钱,他就算是让她和他结婚她都愿意。一年后的宁影后结婚了,对象据说超有钱,一众人不信。当宁肜肜开着玛莎拉蒂出现在影视大片开幕会上,当看着播放的宁肜肜和影视巨星的照片时,当宁肜肜抱着帝国集团总裁的大腿出现在人们的眼前。所有人都知道了,宁肜肜发了!
  • 金榜佳苑纪事

    金榜佳苑纪事

    年少时,总觉得一辈子很长,以为很多事情即使现在不做,以后也还有机会。渐渐地长大了,那些想做的事,终究没有做,想见的人,也没有见,留着留着就留成了岁月里的遗憾。
  • 天耀猎神

    天耀猎神

    绝代杀手凌云暗杀失败,肉身粉碎,灵魂穿越到了天耀大陆。这是一个异能者的世界,这是一个荒兽横行的世界。在天耀大陆,专门猎杀荒兽的人,被称为猎荒者。凌云从一名普通的猎荒者开始,一路杀伐,灭尽无数荒兽,踏过无数强者,最终成为天耀大陆第一强者,并将荒兽赶出了天耀大陆。世人称他为——猎神!
  • 真武仙道

    真武仙道

    修改以后,全新的设定,大家请进!由于自己的原因耽误了很长的时间,十分抱歉,但是以后不会了,大家继续支持一下。以后更新的时间定为中午一章,晚上一章,加更的时候会告诉大家的。无论是推荐票,收藏还是打赏,评论还是评分,大家都搞起来吧,把这里搞的活跃一点。加精的时间定在每周的星期日晚上八点,大家有什么看法,意见请在书评区发表出来,谢谢!求推荐,收藏!本书书友群92343480【感谢书友病毒|邪君提供!】
  • 情深深不知所起

    情深深不知所起

    他不知那一推差点把两人走上了绝路,三年后,她对她冷漠相对
  • 科学伴你行-动物奇趣

    科学伴你行-动物奇趣

    本书介绍了有关动物的知识,内容丰富,把青少年带入一个五彩缤纷的动物世界,体会大自然的神奇的创造力,有利于中小学生更好地了解动物知识。
  • 新农村十万个怎么办·新技术·如何办好蝎养殖场

    新农村十万个怎么办·新技术·如何办好蝎养殖场

    本书介绍了最新的、详尽的如何办好养蝎场的技术,以及适应市场经济的经营管理知识,解答人们在养殖过程中遇到的疑难问题。