Design and Architecture
Design and Architecture
Design and Architecture
Software engineering: To design, to implement, to test and maintain software. Software engineering tells the methodology to produce software. Soft engineering is a balancing act. Everything will be optimized quality satisfaction of customer. Software engineering processes: i. System engineering. ii. Analysis, design, coding etc. Design is focused for quality. In analysis first we collect requirements then see wither there is Missing requirements Extras requirements Specific requirements Remove wrong requirements Correct the wrong things Design Guidelines: Design should exhibit an architectural structure. A design should be modular; That is, the software should be logically partitioned into elements or subsystems. A design should contain distinct representations of data, architecture, interfaces, and components. A design should lead to structure that are appropriate for the objects to be implemented. A design should lead to component that exhibit independent functional characteristics. A design should lead to interface that reduce the complexity of connections between modules and external environment. A design should be derived using a repeatable method. The design must implement all of the explicit requirements contained in the analysis model, and it must accommodate all of the implicit requirements desired by the customer. The design must be a readable and understandable guide for those who generate code and for those who test and subsequently support the software. The design should provide a complete picture of the software, addressing the data, functional and behavioral domains from an implementation perspective. A design should be represented using a notation that effectively communicates its meaning. A design should exhibit an architecture that - Has been created using recognizable architectural styles or patterns. - Is composed of components that exhibit good design characteristics and. - Can be implemented in an evolutionary fashion. Design principle: The design process should not suffer from tunnel vision. Design should not reinvent the wheel. The design should exhibit uniformity and integration. - Same modules within each component understandable to each. Design should be traceable to the analysis model. - DFD (process within s/w). - ERD (static just like statement). - STD (show structure, different states, observable issues). The design should be structured to accommodate change. Design should degrade (humiliate) gracefully to be handling easily, not hang when giving undesirable words must give message that is not correct. Design should minimize the distance between problem and solution. The design should be reviewed to minimize conceptual (semantic) errors. Design should be accessed for quality. Design is not coding, Coding is not design. The design should be traceable to the analysis model. The design should be structured to accommodate change. Design Concepts: (16/9/2013) 1. Abstraction: Considering a problem at low level of generalization. Tacking our point of interest. Concentrate on the essential features and ignore details that are not relevant. Considering only certain perspectives.
1 ijazulhaq716@gmail.com
2 ijazulhaq716@gmail.com
Types of coupling: i. Data Coupling: Modules communicate by parameters. One to one correspondence of items exists. Two components are data coupled if there are homogeneous data items. Data coupling is passing only the data needed. Only simple data is passed between modules. ii. Stamp Coupling: Passing composite data between modules is called stamp coupling. Occurs when complete data structures are passed from one module to another. Component passes a data structure to another component that does not have access to the entire structure. Stamp coupling is passing more data than is needed. Stamp coupling should be avoided. Components should only be given the data that is relevant to their task. An example of stamp coupling is to pass a data structure to a component that only requires the ages of the people in the census to calculate the average age. The precise format of the data structures is a common property of those modules. iii. Control Coupling: A module controls the logic of another module. I.e. in if statement to check the condition in one function and decision is taken in other function. Control coupling arises when a method does different things depending on the value of a flag parameter. Control coupling is communication by flags. It is bad practice to use control coupling for the primary control flow; this should be implied by the component hierarchy. It is acceptable to use control coupling for secondary control flows such as in error handling. Module directs the execution of another module by passing the necessary control information. Accomplished by means of flags that set by one module and reacted upon by the dependent module. iv. Hybrid Coupling: A set of data is used as control. v. Common Coupling: Two modules have shared data. This coupling is done by the use of global variables. Occurs when a number of modules reference a global data area. Usually a poor design choice because - Lack of clear responsibility for the data. - Reduces readability. - Difficult to determine all the components that affect a data element (reduces maintainability). - Difficult to reuse components. - Reduces ability to control data accesses. Common coupling is communication by means of global data, and causes data to be less secure because faults in components that have access to the data area may corrupt it. Common coupling should normally be avoided, although it is sometimes necessary to provide access to data by components that do not have a direct call connection (e.g. if A calls B, B calls C, and A has to pass data to C).
3 ijazulhaq716@gmail.com
4 ijazulhaq716@gmail.com
5 ijazulhaq716@gmail.com
Abstract Data Type (ADT) is a mathematical model for a certain class of data structures that have similar behavior; or for certain data types of one or more programming languages that have similar semantics. An ADT is defined indirectly, only by the operations that may be performed on it and by mathematical constraints on the effects of those operations.
ADT Offers Following Advantages: i. Encapsulation/Data hiding. ii. High cohesion and low coupling. iii. E2 and understandable design solution. iv. Modeling. Design Patterns: (3/10/2013) These are commonly accepted solutions which recur (repeat) in designing different applications. Design pattern is actually a solution which reduces our efforts. Design pattern reduces the number of design iterations. Pattern is a solution to a problem in a context. Alexander says Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing the same thing twice. Help improve the quality of the software in terms of the software being reusable, maintainable, extensible, etc. Reduce the development time. Patterns are more generic in nature and can be used in almost any kind of application. The basic theme is if few patterns are made they can be used in other design pattern also. - No needs to worry just call them. - Suppose we construct such classes in object oriented that can be used in future. - The reuse is increased and a lot of problems are solved, but unfortunately some problems generate, i.e. complexity increased. A pattern is basically a documented solution which consists of four things. i. The problem. ii. The solution. iii. The context in which the problem exist. iv. The context in which the solution will be implemented Capture expertise and make it accessible to non-experts in a standard form. Facilitate communication among developers by providing a common language. Make it easier to reuse successful designs and avoid alternatives that reduce reusability. Facilitate design modifications. Improve design documentation and understandability. Expert: i. The problem: When a certain activity is needed to be performed, which class should be made responsible for this activity? ii. Solution: Assign responsibility to the information expert. - Suppose we have three classes.
Sale Transaction Sale Item Sale Specification
1
-
We have an activity to calculate total transaction price. To which class this activity will be assigned?. So we look that only class 1 can perform this activity, because only with this class all the information is available, the other two classes (2, 3) has not enough information. - We assign an activity to an expert because may be it can solve the problem well. - Design pattern is also a communication tool and the others can know it. - Patterns and algorithm are similar but patterns focus on understandability and maintainability while the algorithm focuses on complexity (time and space). Design process translates the analysis model into design model. Design Model: (4/10/2014) Design model consists of four components. i. Data design: It transforms data model into classes and other data structures. ERD (Entity Relationship Diagram) is a representation of data model. DFD (Data Flow Diagram) is a representation of functional model; it shoes the flow of data.
6 ijazulhaq716@gmail.com
iv.
Software Architecture: Software architecture defines the structure or structures of the system, their elements, their externally visible properties and their relationships. Architecture is the abstraction (concept) of a system. External visible things are - Provide services. - Required services. - Fault tolerance ability. - Resource utilization. - Performance characteristics. Software architecture is the overall structure of the software and the ways in which that software provides conceptual integrity for a system. Architecture is the set of principal design decisions governing a system. Architecture is very important because it shows the basic layout of the system. The better will that to first design the architecture. Architecture involves the how and the why, not just the what. Architecture focuses on significant design decisions, decisions that are both structurally and behaviorally important. A system may have multiple views. Architectural View: The representation of the system structural elements (focusing of a single type) is called view. - Different views represent different aspects of a system. - A single view is about a single aspect of the system. - A view also tells about the relationship. A communication tool. - Negotiating or discussing requirements with the user, - Informing the customer about the progress. - Implementing management decisions and allocations. Having architecture make the changes easy. The changes may be categorized into three types. i. Local changes. ii. Non-local changes.
7 ijazulhaq716@gmail.com
Architecture Drivers: (24/10/2013) These are basic requirements which drive architecture, means used in deciding an architecture style. These requirements may be - Functional. - Non-functional. - Related to quality. Architecture Styles or Patterns: These are the organizational recurring patterns or abstracted and reusable models. An important and recurring system construct. They can describe relatively complex protocols of interactions between objects as a single abstraction. Pattern defines a process for solving a problem by following a path of design and implementation choices. A set of design rules that identify the kinds of components and connectors that may be used to compose a system or Subsystem, together with local or global constraints on the way the composition is done. Architectural style determines a set of components together with a set of constraints on how they can be combined. Architectural Styles are of two types. i. Domain Dependent (Reference Model): It can be used in a specific domain. ii. Domain Independent (Global Model) We have four architectural styles i. Structural Style. ii. Distributed Style. iii. Interactive Style. iv. Adaptable Style. i. Structural Style: It divides a system into subsystems and every subsystem works independently. The output of one subsystem is input for the other subsystem. Each system does his task independent and then passes to the next. The main function is performed sequentially. The techniques used in structural style architecture are, Pipe and Filters, Blackboards and Layered Architecture. Pipe and Filters: In this style the nature of the components is same. Consists of individual components, each component has a set of inputs and a set of outputs. There is sequential data flow and transaction. Allow the designer to understand the overall input/output behavior of a system. The example of pipe and filter style is Compiler. Compiler:
High Level Language Semantic Analysis
Lexical Analysis
Syntax Analysis
Machine Language
Code Generation
Optimization
IR
Each component is connected with another to receive information. This architecture style is called Pipe and Filter architecture. Simple, intuitive and efficient composition of components. High potential for reuse. Easy to evolve and enhance. Potential for limited amount of concurrency. Blackboards: A blackboard system is a task independent architecture for integrating multiple problem solving modules. A blackboard system a common global database. There are two components in blackboard, i. Blackboard ii. Processers i. Blackboard is simply a data structure. ii. Processor is individual component, also called problem solving module.
8 ijazulhaq716@gmail.com
9 ijazulhaq716@gmail.com