1. Trang chủ
  2. » Công Nghệ Thông Tin

Software design: Lecture 9 - Sheraz Pervaiz

37 3 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Software design - Lecture 9. The main topics covered in this chapter include: software design components; range of coupling; common coupling – high coupling; lack of clear responsibility for the data; reduces readability; reduces ability to control data accesses;...

1 Software Design Lecture : 9 Software Design Components Ø Principle  Ø Criteria (this lecture) Ø Techniques Range of Coupling High Coupling Content Common Control Stamp Loose Data Uncoupled Low Common Coupling – High  Coupling  Definition: Two components share data § Global data structures § Common blocks Usually a poor design choice because Example­1 ü Process control component maintains current data  about state of operation. Gets data from multiple  sources. Supplies data to multiple sink ü Each source process writes directly to global data  store. Each sink process reads directly from global  data store Diagrammatic Representation Shared Data Store Source ­1  Variable a Source ­2 Source ­3 Sink Read  directly  from Variable a Write  directly to  Variable a Example­2 Process control component maintains current data about state  of operation. Gets data from multiple sources. Supplies data  to multiple sinks Each source process writes directly to global data store.  Each sink process reads directly from global data store Improvement     Data manager component is responsible for data in data  store. Processes send data to and request data from data  10 Diagrammatic Representation Data Manager Source ­1  Variable a Source ­2 Source ­3 Sink Places request to  read Places request to  write Example­ I/O Operation ü A component reads inputs from tape, disk, and network.  All the code for these functions are in the same  component.  ü Operations are related, but the functions are  significantly different 24 TEMPORAL COHESION Ø A temporally cohesive module is one which performs  several activities that are related in time Ø Temporally cohesive modules typically consist of partial  activities whose only relationship to one another is that  Example ü One of the most common examples of a temporally  cohesive module is an initialization routine that  initializes data used by many modules throughout a  system Procedural Cohesion Ø Definition: Elements of a component are related  only to ensure a particular order of execution Ø  Module with (only) procedural cohesion is one  supporting different and possibly unrelated  activities, in which control passes from one  activity to the next Example ü i the intent of this  Read part number from  data base ii update repair record on  maintenance file May be useful to abstract  sequence. Make the data  base and repair record  components handle  reading and updating.  Make component that  handles more abstract  operation Communicational Cohesion Ø Definition: Module performs a series of actions related  by a sequence of steps to be followed by the product and  all actions are performed on the same data Ø A communication ally cohesive module is one which  performs several functions on the same input or output  Example Ø Update record in data base and send it to the  printer Ø Obtain author, title, or price of book from  bibliographic record, based on a passed flag Sequential Cohesion Ø The output of one component is the input to  another Ø Occurs naturally in functional programming  languages Ø 31 Example i Retrieve customer Data ii  Retrieve customer order  iii Generate invoice iv Get and edit input data Functional Cohesion – Highly  cohesive Ø Definition: Every essential element to a single  computation is contained in the component Ø A functionally cohesive module performs one  and only one problem related task 33 Examples Ø Read Customer Record, Ø Calculate Net Pay Ø A complex module with numerous sub modules  may still be functionally cohesive if all of its  subordinate modules are only performed to carry  34 Sufficient ü  Each component has all the features needed for  a sensible and efficient usage within the  abstraction ü The interface is as small as possible ü Minimum possible interface is to be selected 35 Complete  ü Each component has all relevant features within  the abstraction; a general interface can be  reused 36 Simple ü All features of a components are easy to  understand (and implement);  ü Complex features are built up of simpler  features 37 Simple ü All features of a components are easy to  understand (and implement);  ü Complex features are built up of simpler  features ...2 Software? ?Design Components Ø Principle  Ø Criteria (this? ?lecture) Ø Techniques Range of Coupling High Coupling Content Common

Ngày đăng: 05/07/2022, 13:59

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN