Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 45 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
45
Dung lượng
2,03 MB
Nội dung
Software DesignSoftwareDesign • Introduction to SoftwareDesign • Design Concepts • Function-Oriented Design Introduction to SoftwareDesign • Design is module view. The system viewed as a collection of code units. Each module implements some part of the system functionality. • Determine what modules the system should have and which have to developed • Modules can be packages, a class, a procedure, a method, a collection of functions, and a collection of classes Introduction to… • Relationships between modules are code-based and depend how code of a module interacts with another module. – “is a part of” (module B is a part of module A) – “user depends on” (module A uses services of module B to perform its own functions and correctness of model A depends on correctness of module B) – “generalization or specialization” (module B is a generalization of module A. E.g. B is superclass, A is subclass) Design Process • Module design (high-level design): Decide which modules needed for system, specifications of these modules, and how the modules should be interconnected • Detailed design (logic design): Decide internal design of modules, how the specifications of module can be satisfied - Detailed description of the processing logic and data structures Design Methodology • A systematic approach of creating a design by applying of a set of techniques and guidelines. Design concepts • A design is correct if a system built satisfies requirements. • There can be many correct designs, the goal is to find the best possible design • Evaluate design. Main criterion is modularity - Coupling - Cohesion - Open-Closed Principle Modularity • A system is considered modular if it consists of discrete modules so that each module can be implemented separately, and a change to one module has minimal impact on other modules. Coupling • Independence: one module can function without presence of the other. The more independent the connection between modules, the easier to solve and modify modules • Coupling: the strength of interconnections between modules. The more we must know about module A to understand module B, the more closely connected A is to B Cohesion • Coupling is reduced when elements in different modules have little or no bonds between them. • Another way is to strengthen the bond between elements of the same module by maximizing the relationship between them • Cohesion of a module represents how tightly bond the internal elements of the module are to one another • Usually, the greater the cohesion of each module in the system, the lower the coupling between modules is. [...]... Structured Design Methodology (SDM) • The objective of the structured design methodology is to control the eventual structure of the system by fixing the structure during design • The aim is to design a system so that programs implementing the design would have a hierarchical structure, with functionally cohesive modules and as few interconnections between modules as possible Structured Design Methodology... Structured Design Methodology … • No design methodology reduces design to a series of steps that can be mechanically executed All design methodologies are, at best, a set of guidelines that, if applied, will most likely produce a design that is modular and simple • The basic principle behind the structured design methodology is problem partitioning • Structured design methodology partitions the system... existing source code of the module is not changed when making enhancements Open-Closed Principle… • This principle can be satisfied in ObjectOriented designs by properly using inheritance and polymorphism Function-Oriented Design • Structure charts • Structured Design Methodology • An Example Structure Charts • The structure of a program is made up of the modules and the interconnections between modules... the information and then represent it as a DFD • During design activity: dealing with the solution domain and developing a model for the eventual system DFD represents how the data will flow in the system when it is built In this modeling, the major transforms or functions in the software are decided, and the DFD shows the major transforms that the software will have and how the data will flow through... nice (succinct) representation for a design that uses functional abstraction • It shows the modules and their call hierarchy, the interfaces between the modules, and what information passes between modules – Through the interface one module can interact with other modules An interface of a module is used to pass information to and from other modules • So, for a software system, once its structure is...Open-Closed Principle • Goal: also to promote building of easily modified systems: A design that not easy to accommodate change will result in fast died system • Basic principle: Software entities should be open for extension, but closed for modification” A module being “open for extension” means that its behavior can be extended... modules • Every computer program has a structure, and given a program its structure can be determined • The structure chart of a program is a graphic representation of its structure • A function-oriented design can be represented graphically by structure charts Structure Charts… • In a structure chart: - A module is represented by a box with the module name written in the box - An arrow from module A to... methodology partitions the system at the very top level into various subsystems, one for managing each major input, one for managing each major output, and one for each major transformation Structured Design Methodology … • modules dealing with inputs have to deal with issues of screens, reading data, formats, errors, exceptions, completeness of information, structure of the information, etc • modules... N) int a[], N; { : if (a[i] > a[t]) switch (a[i], a[t ]); : } /* Add the first n numbers of a */ add_n (a, n) int a[], n; { : } Example… The structure chart of the sort program: Structure Charts… • The designer may wish to communicate certain procedural information explicitly, like major loops and decisions A repeatedly calls the modules C and D the invocation of modules C and D in module A depends on . Software Design Software Design • Introduction to Software Design • Design Concepts • Function-Oriented Design Introduction to Software Design • Design is module view subclass) Design Process • Module design (high-level design) : Decide which modules needed for system, specifications of these modules, and how the modules should be interconnected • Detailed design. creating a design by applying of a set of techniques and guidelines. Design concepts • A design is correct if a system built satisfies requirements. • There can be many correct designs, the