首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
In computer programming, cohesion and coupling are used to describe modules of code. Which of the following is a favorable combi
In computer programming, cohesion and coupling are used to describe modules of code. Which of the following is a favorable combi
admin
2013-12-19
61
问题
In computer programming, cohesion and coupling are used to describe modules of code. Which of the following is a favorable combination of cohesion and coupling?
选项
A、Low cohesion, low coupling
B、High cohesion, high coupling
C、Low cohesion, high coupling
D、High cohesion, low coupling
答案
D
解析
D正确。如果一个模块被描述为具有高内聚(cohesion)、低耦合(coupling)性,这是个好事。内聚反映的是一个模块能够执行多少种不同类型的任务。高内聚意味着这个模块执行的是一个基本任务(如数值的减法)或几个非常相似的任务(如减法、加法、乘法)。内聚程度越高,更新或修改一个模块且不影响其他与之交互的模块就越容易。这也意味着该模块更容易重复使用和维护,因为与低内聚的模块相比它更简单。耦合显示了一个模块为了执行其任务需要进行多少次交互的衡量。如果一个模块是低耦合或者松散耦合,这意味着这个模块在执行它的工作时不需要与许多其他模块进行通信。与那些依靠许多其他模块进行工作的模块相比,这些模块更容易被理解和重复使用。而且,修改这些模块也更加容易,也不会影响它们周围的众多模块。
A不正确。因为低内聚的模块是不可取的。低内聚的模块会执行几个不同的任务,增加了这个模块的复杂性,使之更难维护和重复使用。一个模块的内聚程度越高,它执行的任务越少,越容易对其进行更新或者修改,而不影响其他与之交互的模块。
B不正确。因为高耦合的模块是不可取的。高耦合意味着一个模块依赖于很多其他的模块来执行其任务。这使得它因为与其他模块的相互依存关系而很难被理解、重复使用和修改。打个比方,公司希望员工能够在尽量不依靠其他员工的情况下执行他们各自的任务。如果Joe需要与5个人进行交流才能完成他的工作,这说明太过复杂,也太耗时,当然出错误的地方也会更多。
C不正确。因为这一陈述说得与正确的恰恰相反。一个低内聚、高耦合的模块十分复杂,因为它需要执行几个不同类型的任务并依靠许多其他模块来执行这些任务。这些特点使得这个模块更难维护和重复使用,这是由于它很大程度上增大了影响到与之交互的其他模块的可能性。
转载请注明原文地址:https://kaotiyun.com/show/EAhZ777K
0
CISSP认证
相关试题推荐
AsformercolonistsofGreatBritain,theFoundingFathersoftheUnitedStatesadoptedmuchofthelegalsystemofGreatBritai
Individualsandbusinesseshavelegalprotectionforintellectualpropertytheycreateandown.Intellectualproper【C1】______fro
Individualsandbusinesseshavelegalprotectionforintellectualpropertytheycreateandown.Intellectualproper【C1】______fro
Publicrelationsisabroadsetofplannedcommunicationsaboutthecompany,includingpublicityreleases,designedtopromoteg
In2009theEuropeanCommissioncarriedoutaninvestigationintoMicrosoft.TheAmericansoftwaregianttiedInternetExplorer,
TimeintheAnimalWorldRhythmcontrolseverythinginNature.41Thesunprovidesabasictimerhythmforalllivingcr
Writeanessayof160-200wordsbasedonthefollowingdrawing.Inyouressay,youshould1)describethedrawingbriefly,
Writeanessayof160-200wordsbasedonthefollowingdrawing.Inyouressay,youshouldfirstdescribethedrawing,theninte
Supposeyouwanttoapplyforajobinacompanyasanofficesecretary.Writeanapplicationemailto1)introduceyourself
YouaredoingyourUCLAapplicationforgraduateadmission,andyouneedtworeferenceletters.Pleaseemailyourformerforeign
随机试题
肺性脑病
胫骨中下1/3交界处是骨折的好发部位,其原因是
根据《中华人民共和国环境保护法》的规定,有关环境质量标准的下列说法中,正确的是:
建设社会主义新农村有以下()要求。
背景创建文明建设工地是工程建设物质文明和精神文明的最佳结合点;是工程项目管理的中心环节;同时也是水利水电企业按照现代企业制度要求,加强企业管理,树立企业良好形象的需要。某水利枢纽工程积极参与文明工地评选,由该工程建设单位向上级提出申请,并准备了相
网络计划调整的方法有______。
挡烟高度即各类挡烟设施处于安装位置时,其底部与顶部之间的垂直高度,要求不得小于()。
Theboss______intoarageandstartedshoutingatRoberttodoashewastold.
Andersonwasdisappointedwhenhefoundouttheyhadgonetothetest-site______him.
Hehasabadcoldand______iswhyhedidn’tcome.
最新回复
(
0
)