tailieunhanh - Lecture Systems analysis and design with UML (3/e) - Chapter 9: Class and method design

This chapter presents a set of criteria, activities, and techniques used to design classes and methods. Together they are used to ensure the object-oriented design communicates how the system needs to be coded. | Chapter 9: Class and Method Design Objectives Become familiar with coupling, cohesion, and connascence. Be able to specify, restructure, and optimize object designs. Be able to identify the reuse of predefined classes, libraries, frameworks, and components. Be able to specify constraints and contracts. Be able to create a method specification. BASIC CHARACTERISTICS OF OBJECT ORIENTATION Elements of OOSAD Classes Objects Attributes States Methods Messages Encapsulation & Info Hiding Hiding the content of the object from outside view Communication only through object’s methods Key to reusability Polymorphism & Dynamic Binding Same message triggers different methods in different objects Dynamic binding means specific method is selected at run time Implementation of dynamic binding is language specific Need to be very careful about run time errors Need to ensure semantic consistency Polymorphism Example Inheritance Single inheritance -- one parent class Multiple inheritance -- multiple . | Chapter 9: Class and Method Design Objectives Become familiar with coupling, cohesion, and connascence. Be able to specify, restructure, and optimize object designs. Be able to identify the reuse of predefined classes, libraries, frameworks, and components. Be able to specify constraints and contracts. Be able to create a method specification. BASIC CHARACTERISTICS OF OBJECT ORIENTATION Elements of OOSAD Classes Objects Attributes States Methods Messages Encapsulation & Info Hiding Hiding the content of the object from outside view Communication only through object’s methods Key to reusability Polymorphism & Dynamic Binding Same message triggers different methods in different objects Dynamic binding means specific method is selected at run time Implementation of dynamic binding is language specific Need to be very careful about run time errors Need to ensure semantic consistency Polymorphism Example Inheritance Single inheritance -- one parent class Multiple inheritance -- multiple parent classes Redefinition and inheritance conflict Most inheritance conflicts are due to poor classification Rumbaugh’s Rules Query operations should not be redefined Methods that redefine inherited ones should only restrict the semantics of the inherited ones The underlying semantics of the inherited method should never be changed The signature (argument list) of the inherited method should never be changed DESIGN CRITERIA Coupling Interdependency among modules Interaction coupling through message passing Law of Demeter Messages should be sent only by an object: to itself to objects contained in attributes of itself or a superclass to an object that is passed as a parameter to the method to an object that is created by the method to an object that is stored in a global variable Types of Interactive Coupling Cohesion “Single-mindedness of a module” Method cohesion Class cohesion Types of Method Cohesion Types of Class Cohesion Connascence Creating the need to change another module

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.