ImageVerifierCode 换一换
格式:PPT , 页数:93 ,大小:4.76MB ,
资源ID:13323816      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/13323816.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(软件工程第7版课件.ppt)为本站上传会员【仙人****88】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

软件工程第7版课件.ppt

1、Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,Slide 7.,*,The McGraw-Hill Companies,2007,Object-Oriented and Classical Software Engineering,Seventh Edition,WCB/McGraw-Hill,2007,Stephen R.Schach,srsvuse.vanderbilt.edu,CHAPTER 7,FROM

2、 MODULES,TO OBJECTS,Overview,What is a module?,Cohesion,Coupling,Data encapsulation,Abstract data types,Information hiding,Objects,Inheritance,polymorphism,and dynamic binding,The object-oriented paradigm,7.1 What Is a Module?,A lexically contiguous sequence of program statements,bounded by boundary

3、 elements,with an aggregate identifier,“Lexically contiguous”,Adjoining in the code,“Boundary elements”,.,begin,.,end,“Aggregate identifier”,A name for the entire module,Design of Computer,A highly incompetent computer architect decides to build an ALU,shifter,and 16 registers with AND,OR,and NOT ga

4、tes,rather than NAND or NOR gates,Figure 7.1,Design of Computer(contd),The architect designs three silicon chips,Figure 7.2,Design of Computer(contd),Redesign with one gate type per chip,Resulting“masterpiece”,Figure 7.3,Computer Design(contd),The two designs are functionally equivalent,The second d

5、esign is,Hard to understand,Hard to locate faults,Difficult to extend or enhance,Cannot be reused in another product,Modules must be like the first design,Maximal relationships within modules,and,Minimal relationships between modules,Composite/Structured Design,A method for breaking up a product int

6、o modules to achieve,Maximal interaction within a module,and,Minimal interaction between modules,Module cohesion,Degree of interaction within a module,Module coupling,Degree of interaction between modules,Function,Logic,and Context of a Module,In C/SD,the name of a module is its function,Example:,A

7、module computes the square root of double precision integers using Newtons algorithm.The module is named,compute_square_root,The underscores denote that the classical paradigm is used here,7.2 Cohesion,The degree of interaction within a module,Seven categories or levels of cohesion(non-linear scale)

8、Figure 7.4,7.2.1 Coincidental Cohesion,A module has coincidental cohesion if it performs multiple,completely unrelated actions,Example:,print_next_line,reverse_string_of_characters_comprising_second_ parameter,add_7_to_fifth_parameter,convert_fourth_parameter_to_ floating_point,Such modules arise f

9、rom rules like,“Every module will consist of between 35 and 50 statements”,Why Is Coincidental Cohesion So Bad?,It degrades maintainability,A module with coincidental cohesion is not reusable,The problem is easy to fix,Break the module into separate modules,each performing one task,7.2.2 Logical Coh

10、esion,A module has logical cohesion when it performs a series of related actions,one of which is selected by the calling module,Logical Cohesion(contd),Example 1:,function_code=7;,new_operation(op code,dummy_1,dummy_2,dummy_3);,/dummy_1,dummy_2,and dummy_3 are dummy variables,/not used if function c

11、ode is equal to 7,Example 2:,An object performing all input and output,Example 3:,One version of OS/VS2 contained a module with logical cohesion performing 13 different actions.The interface contains 21 pieces of data,Why Is Logical Cohesion So Bad?,The interface is difficult to understand,Code for

12、more than one action may be intertwined,Difficult to reuse,Why Is Logical Cohesion So Bad?(contd),A new tape unit is installed,What is the effect on the laser printer?,Figure 7.5,7.2.3 Temporal Cohesion,A module has temporal cohesion when it performs a series of actions related in time,Example:,open

13、old_master_file,new_master_file,transaction_file,and print_file;initialize_sales_district_table,read_first_transaction_record,read_first_old_master_record(a.k.a.perform_initialization),Why Is Temporal Cohesion So Bad?,The actions of this module are weakly related to one another,but strongly related

14、 to actions in other modules,Consider,sales_district_table,Not reusable,7.2.4 Procedural Cohesion,A module has procedural cohesion if it performs a series of actions related by the procedure to be followed by the product,Example:,read_part_number_and_update_repair_record_on_,master_file,Why Is Proce

15、dural Cohesion So Bad?,The actions are still weakly connected,so the module is not reusable,7.2.5 Communicational Cohesion,A module has communicational cohesion if it performs a series of actions related by the procedure to be followed by the product,but in addition all the actions operate on the sa

16、me data,Example 1:,update_record_in_database_and_write_it_to_audit_trail,Example 2:,calculate_new_coordinates_and_send_them_to_terminal,Why Is Communicational Cohesion So Bad?,Still lack of reusability,7.2.6 Functional Cohesion,A module with functional cohesion performs exactly one action,7.2.6 Func

17、tional Cohesion,Example 1:,get_temperature_of_furnace,Example 2:,compute_orbital_of_electron,Example 3:,write_to_diskette,Example 4:,calculate_sales_commission,Why Is Functional Cohesion So Good?,More reusable,Corrective maintenance is easier,Fault isolation,Fewer regression faults,Easier to extend

18、a product,7.2.7 Informational Cohesion,A module has informational cohesion if it performs a number of actions,each with its own entry point,with independent code for each action,all performed on the same data structure,Why Is Informational Cohesion So Good?,Essentially,this is an abstract data type(

19、see later),Figure 7.6,7.2.8 Cohesion Example,Figure 7.7,Figure 7.8,7.3 Coupling,The degree of interaction between two modules,Five categories or levels of coupling(non-linear scale),7.3.1 Content Coupling,Two modules are content coupled if one directly references contents of the other,Example 1:,Mod

20、ule,p,modifies a statement of module,q,Example 2:,Module,p,refers to local data of module,q,in terms of some numerical displacement within,q,Example 3:,Module,p,branches into a local label of module,q,Why Is Content Coupling So Bad?,Almost any change to module,q,even recompiling,q,with a new compile

21、r or assembler,requires a change to module,p,7.3.2 Common Coupling,Two modules are common coupled if they have write access to global data,Example 1,Modules,cca,and,ccb,can access,and change,the value of,global_variable,Figure 7.9,7.3.2 Common Coupling(contd),Example 2:,Modules,cca,and,ccb,both have

22、 access to the same database,and can both read,and,write,the same record,Example 3:,FORTRAN,common,COBOL,common,(nonstandard),COBOL-80,global,Why Is Common Coupling So Bad?,It contradicts the spirit of structured programming,The resulting code is virtually unreadable,What causes this loop to termina

23、te?,Figure 7.10,Why Is Common Coupling So Bad?(contd),Modules can have side-effects,This affects their readability,Example:,edit_this_transaction(record_7),The entire module must be read to find out what it does,A change during maintenance to the declaration of a global variable in one module necess

24、itates corresponding changes in other modules,Common-coupled modules are difficult to reuse,Why Is Common Coupling So Bad?(contd),Common coupling between a module,p,and the rest of the product can change without changing,p,in any way,Clandestine common coupling,Example:The Linux kernel,A module is e

25、xposed to more data than necessary,This can lead to computer crime,7.3.3 Control Coupling,Two modules are control coupled if one passes an element of control to the other,Example 1:,An operation code is passed to a module with logical cohesion,Example 2:,A control switch passed as an argument,Contro

26、l Coupling(contd),Module,p,calls module,q,Message:,I have failed,data,Message:,I have failed,so write error message ABC123,control,Why Is Control Coupling So Bad?,The modules are not independent,Module,q,(the called module)must know the internal structure and logic of module,p,This affects reusabili

27、ty,Associated with modules of logical cohesion,7.3.4 Stamp Coupling,Some languages allow only simple variables as parameters,part_number,satellite_altitude,degree_of_multiprogramming,Many languages also support the passing of data structures,part_record,satellite_coordinates,segment_table,Stamp Coup

28、ling,(contd),Two modules are stamp coupled if a data structure is passed as a parameter,but the called module operates on some but not all of the individual components of the data structure,Why Is Stamp Coupling So Bad?,It is not clear,without reading the entire module,which fields of a record are a

29、ccessed or changed,Example,calculate_withholding(employee_record),Difficult to understand,Unlikely to be reusable,More data than necessary is passed,Uncontrolled data access can lead to computer crime,Why Is Stamp Coupling So Bad?(contd),However,there is nothing wrong with passing a data structure a

30、s a parameter,provided that,all,the components of the data structure are accessed and/or changed,Examples:,invert_matrix(original_matrix,inverted_matrix);,print_inventory_record(warehouse_record);,7.3.5 Data Coupling,Two modules are data coupled if all parameters are homogeneous data items(simple pa

31、rameters,or data structures all of whose elements are used by called module),Examples:,display_time_of_arrival(flight_number);,compute_product(first_number,second_number);,get_job_with_highest_priority(job_queue);,Why Is Data Coupling So Good?,The difficulties of content,common,control,and stamp cou

32、pling are not present,Maintenance is easier,7.3.6.Coupling Example,Figure 7.11,Coupling Example(contd),Interface description,Figure 7.12,Coupling Example(contd),Coupling between all pairs of modules,Figure 7.13,7.3.7 The Importance of Coupling,As a result of tight coupling,A change to module,p,can r

33、equire a corresponding change to module,q,If the corresponding change is not made,this leads to faults,Good design has high cohesion and low coupling,What else characterizes good design?(see over),Key Definitions,Figure 7.14,7.4 Data Encapsulation,Example,Design an operating system for a large mainf

34、rame computer.Batch jobs submitted to the computer will be classified as high priority,medium priority,or low priority.There must be three queues for incoming batch jobs,one for each job type.When a job is submitted by a user,the job is added to the appropriate queue,and when the operating system de

35、cides that a job is ready to be run,it is removed from its queue and memory is allocated to it,Design 1(Next slide),Low cohesion operations on job queues are spread all over the product,Data Encapsulation Design 1,Figure 7.15,Data Encapsulation Design 2,Figure 7.16,Data Encapsulation(contd),m_encaps

36、ulation,has informational cohesion,m_encapsulation,is an implementation of data encapsulation,A data structure(,job_queue,)together with operations performed on that data structure,Advantages,Development,Maintenance,Data Encapsulation and Development,Data encapsulation is an example of,abstraction,J

37、ob queue example:,Data structure,job_queue,Three new functions,initialize_job_queue,add_job_to_queue,delete_job_from_queue,7.4.1 Data Encapsulation and Development,Abstraction,Conceptualize problem at a higher level,Job queues and operations on job queues,Not a lower level,Records or arrays,Stepwise

38、 Refinement,1.Design the product in terms of higher level concepts,It is irrelevant how job queues are implemented,2.Then design the lower level components,Totally ignore what use will be made of them,Stepwise Refinement(contd),In the 1st step,assume the existence of the lower level,Our concern is t

39、he behavior of the data structure,job_queue,In the 2nd step,ignore the existence of the higher level,Our concern is the implementation of that behavior,In a larger product,there will be many levels of abstraction,7.4.2 Data Encapsulation and Maintenance,Identify the aspects of the product that are l

40、ikely to change,Design the product so as to minimize the effects of change,Data structures are unlikely to change,Implementation details may change,Data encapsulation provides a way to cope with change,Implementation of,JobQueueClass,C+,Java,Figure 7.17,Figure 7.18,Implementation of,queueHandler,C+,

41、Java,Figure 7.19,Figure 7.20,Data Encapsulation and Maintenance(contd),What happens if the queue is now implemented as a two-way linked list of,JobRecordClass,?,A module that uses,JobRecordClass,need not be changed at all,merely recompiled,Figure 7.22,Figure 7.21,C+,Java,Data Encapsulation and Maint

42、enance(contd),Only implementation details of,JobQueueClass,have changed,Figure 7.23,7.5 Abstract Data Types,The problem with both implementations,There is only one queue,not three,We need:,Data type+operations performed on instantiations of that data type,Abstract data type,Abstract Data Type Exampl

43、e,(Problems caused by,public,attributes solved later),Figure 7.24,Another Abstract Data Type Example,(Problems caused by,public,attributes solved later),Figure 7.25,7.6 Information Hiding,Data abstraction,The designer thinks at the level of an ADT,Procedural abstraction,Define a procedure extend the

44、 language,Both are instances of a more general design concept,information hiding,Design the modules in a way that items likely to change are hidden,Future change is localized,Changes cannot affect other modules,Information Hiding(contd),C+abstract data type implementation with information hiding,Fig

45、ure 7.26,Information Hiding(contd),Effect of information hiding via,private,attributes,Figure 7.27,Major Concepts of Chapter 7,Figure 7.28,7.7 Objects,First refinement,The product is designed in terms of abstract data types,Variables(“objects”)are instantiations of abstract data types,Second refinem

46、ent,Class:an abstract data type that supports,inheritance,Objects are instantiations of classes,Inheritance,Define,HumanBeingClass,to be a,class,An instance of,HumanBeingClass,has,attributes,such as,age,height,gender,Assign values to the attributes when describing an object,Inheritance(contd),Define

47、ParentClass,to be a,subclass,of,HumanBeingClass,An instance of,ParentClass,has all the attributes of an instance of,HumanBeingClass,plus attributes of his/her own,nameOfOldestChild,numberOfChildren,An instance of,ParentClass,inherits all attributes of,HumanBeingClass,Inheritance(contd),The property

48、 of inheritance is an essential feature of all object-oriented languages,Such as Smalltalk,C+,Ada 95,Java,But not of classical languages,Such as C,COBOL or FORTRAN,Inheritance(contd),UML notation,Inheritance is represented by a large open triangle,Figure 7.29,Java Implementation,Figure 7.30,Aggregat

49、ion,UML notation for aggregation open diamond,Figure 7.31,Figure 7.32,Association,UML notation for association line,Optional navigation triangle,Equivalence of Data and Action,Classical paradigm,record_1.field_2,Object-oriented paradigm,thisObject.attributeB,thisObject.methodC(),Figure 7.33a,7.8 Inh

50、eritance,Polymorphism and Dynamic Binding,Classical paradigm,We must explicitly invoke the appropriate version,Figure 7.33(b),Inheritance,Polymorphism and Dynamic Binding(contd),Object-oriented paradigm,Inheritance,Polymorphism and Dynamic Binding(contd),Classical code to open a file,The correct met

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服