html5-img
1 / 50

Program Design

Program Design. Introduction. The process of design involves “conceiving and planning out in the mind” and making a drawing , pattern or sketch of”. In software design there are three distinct type of activities: External Design. Architectural design. Detailed design. . Introduction.

kiora
Télécharger la présentation

Program Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program Design

  2. Introduction • The process of design involves “conceiving and planning out in the mind” and making a drawing , pattern or sketch of”. • In software design there are three distinct type of activities: • External Design. • Architectural design. • Detailed design.

  3. Introduction • External design of software involves conceiving ,planning out and specifying the external observable characteristics of a software product. • These characteristics include user display and report format , external data source. • Functional characteristics , performance requirements and high level process structure for the product. • External design begins during the analysis phase and continues into design phase.(Analysis,design,implementation,testing, maintenance) .

  4. Introduction • Requirement definition is concerned with specifying the external , functional and performance requirements for a system. • External design is concerned with refining those requirements and establishing the high level structural view of the system.

  5. Introduction • Internal design involves conceiving , planning out and specifying the internal structure and processing details of software product. • The goals of internal design are to specify internal structure and processing detail , to record design decision and indicate why certain alternatives and trade off were chosen. • The work product of internal design include a specification of architectural structure the details of algorithm and data structure and the test plan.

  6. Introduction • Architectural design is concerned with refining the conceptual view of the system. • Identifying internal processing functions, decomposing high level functions into sub functions, defining internal data stream and data stores and establishing relationship. • Actual interconnection among the functions and data structures and the packaging scheme for the system.

  7. Fundamental Design Concept Abstraction. Information hiding. Structure. Modularity. Concurrency Verification Abstraction • Abstraction is the intellectual tool that allow us to deal with concepts apart from particular instance of those concept. • During software design abstraction allow us to organize and channel our thought process by postponing structural consideration and detailed algorithmic consideration. • Three widely used abstraction mechanism in software design are: • functional abstraction. • data abstraction. • control abstraction.

  8. Fundamental Design Concept • Functional abstraction involves the use of parameterized sub programs. • The ability to parameterized a sub program and to bind different parameter values on different invocations of the sub program is a powerful abstraction mechanism. • Functional abstraction can be generalized to collections of sub programs in which some routines are visible and some are hidden ,visible routines communicate with other groups and the hidden routine exist to support the visible ones

  9. Fundamental Design Concept • Data abstraction specifying a data type or a data type or a data object by specifying legal operation on object. • Abstract data types are abstract in the sense that representation details of the data items are hidden within the group that implements the abstract type. • Other groups that use the abstraction do not have access to the internal details of abstract object, object of abstract type are thus only known by the functions that can be performed on them.

  10. Fundamental Design Concept • Control abstraction is the third commonly used abstraction mechanism in software design. • Control abstraction is used to state a desired effect without stating the exact mechanism of control . • If statement and while statement in modern programming language are abstraction of machine code implementation.

  11. Fundamental Design Concept • Information hiding ,each module in the system hides the internal details of its processing activities and module communicate only through well defined interface. • Information hiding includes a data structure, its internal linkage and the implementation details of the procedure that manipulate it.(Data Abstraction) • Character codes , ordering of character sets, and other implementation details. • Machine dependent details.

  12. Fundamental Design Concept • Modularity, Module is a work assignment for an individual programmer. • Modular system consist of well defined ,manageable units and well defined interfaces among the units. • Modularity enhances design clarity which in turn eases implementation , debugging testing , documenting and maintenance of software product.

  13. Fundamental Design Concept • Modularity, each processing abstraction is well defined sub system that is potentially useful in other applications. • Each function in each abstraction has a single well defined purpose. • Each function manipulates no more than one data structure. • Function share global data selectively. It is easy to identify all routines that share a major data structure. • Function that manipulate the instances of abstract data types are encapsulated with the data structure being manipulated.

  14. Fundamental Design Concept • Concurrency, software system can be categorized as sequential or concurrent. In a sequential system only one portion of the system is active at given time, concurrent system have independent processes that can be activated simultaneously if multiple processes are available. • On a single processor concurrent processes can be interleaved in execution time. This permits implementation of time shared , multi programmed and real time systems. • Problem unique to concurrent system include deadlock, mutual exclusion and synchronization of processes. • Dead lock is an undesirable situation that occur when all processes in a computing system are waiting for other processes to complete some action so that each can proceed. • Mutual exclusion is necessary to ensure that multiple process do not attempt to update the same component of the shared processing state at the same time. • Synchronization is required so that concurrent processes operating at different execution speeds can communicate at the appropriate point in their execution history.

  15. Fundamental Design Concept • Verification, Design is the bridge between customer requirements and an implementation that satisfies those requirements. • A design is verifiable if it can be demonstrated that the design will result in an implementation that satisfy the customer’s requirements . This is typically done in two steps: • Verification that the software requirerments definition satisfies the customer’s needs( verification of the requirements) • Verification that the design satisfies the requirement definition (verification of the design)

  16. Modules and Modularization • Architectural design has the goal of producing well structured, modular software system. • Example of modules include function, procedure and subroutine. • software module to be a named entity having the following characteristics: • Modules contain instruction, processing logic and data structure . • Modules can be separately combined and stored in a library. • Modules can be included in a program. • Modules segment can be used by invoking a name or some parameter. • Modules can use other modules.

  17. Modules and Modularization • Modularization allows the designer to decompose a system into functional units, to impose hierarchical ordering on function usage, to implement data abstraction and to develop independently useful subsystem. • Modularization can be used to isolate machine dependencies, to improve the performance of a software product , or to ease debugging, testing, integration and modification of the system.

  18. Modules and Modularization Coupling. • The goal of software design is to minimize the complexity of interconnection between module is minimized. • The strength of coupling between two modules is influenced by the complexity of the interface, the type of connection and the type of communication. • Modification of a common data block or control block may require modification of all routine that are coupled to that block. • Communication between modules involves passing of data, passing elements of control and modification of one modules code by another module. • Coupling is the measure of the interdependence of one module to another module.

  19. Modules and Modularization Coupling between modules can be ranked on a scale of strongest(least desirable) to weakest (most desirable) as follows: • Content Coupling- content coupling occurs when one module modifies the local data values or instruction in another module. • Common coupling- Modules are bound together by global data structures. Common coupling results when all routines in a program references a single common data block. • Control coupling- control coupling involves passing control flags between modules so that one module controls the sequence of processing steps in another module. • Stamp coupling- It is similar to common coupling . Except that global data item are shared selectively among routines that require the data. Stamp coupling is more desirable than common coupling. • Data coupling- Involves the use of parameter lists to pass data items between routines .The most desirable form of coupling between modules is a combination of stamp and data coupling.

  20. Modules and Modularization Cohesion: • Cohesion of the module is measured in terms of the strength of binding of elements within the module. • Cohesion of a module is measured in terms of strength association of the elements within the module.

  21. Cohesion of element occurs on the scale of weakest(least desirable) to strongest (most desirable) as follows: • Coincidental Cohesion- It occurs when the elements in the module have no apparent relationships to one another. • Logical Cohesion- Implies some relationship among the elements of the module as for example in a module that performs all input and output operations or in a module that edits all data. • Temporal Cohesion- In this all elements are executed at one time and no parameter or logic are required to determine which element to execute.(Program initialization) • Communication Cohesion- It refers to the same set of input and out put data. In this element are executed at one time and also refers to the same data. • Sequential Cohesion- It occurs when the output of one element is the input for the next element. • Functional Cohesion-It is a strong and hence desirable type of binding of elements in module because all elements are related to the performance of a single function.Eg. “Compute square root”, “Obtain random number”,” Write record to file”. • Informational Cohesion- It occurs when the nodule contains a complex data structure and several routines to manipulate the data structure. Each routine in the module exhibits functional binding.

  22. Modules and Modularization In Summary the goal of modularizing a software system using the coupling cohesion criteria is to produce systems that have between the modules and of elements within each module. Stamp and Data Coupling functional or informational cohesion

  23. Design Notation Procedure Templates PROCEDURE NAME: PART OF : CALLED BY: PURPOSE: DESIGNER /DATE(s): Level 1 PARAMETER:(name,modes,attributes,purpose) INPUT ASSERTION :(precondition) OUTPUT ASSERTION:(post condition) GLOBAL: SIDE EFFECTS: Level 2 LOCAL DATA STRUCTURE:(name,attributes,purpose) EXCEPTION:(precondition, response) TIMING CONSTRAINTS: OTHER LIMITATIONS: Level 3

  24. Design Notation • Procedure interface specification are effective notations for architectural design when used in combination with structures charts and data flow diagram. • Modification of global variable, reading or writing a file, opening or closing a file or calling a procedure that exhibits side effects.

  25. Pseudocode • Peseudocode notation can be used in both the architectural and detailed design phases. • Like flow chart pseudocode can be used at any level of abstraction. • Using pseudocode, the designer describes system characteristics using short concise English language phrases. • Pseudocode can replace flow chart and reduce the amount of external documentation required to describe the system. • Peseudocode structured by key words such as if-Then-Else, While – Do and END.

  26. Structured Flow Chart • Notations used in traditional flow chart are similar in structured flow chart but they differ from traditional flow chart. • Structures flow chart are restricted to compositions of certain basic forms. This makes the resulting flow chart the graphical equivalent of a structured pseudocode description. • Because structured flow chart are logically equivalent to pseudocode they have the same expressive power as pseudocode ; both can be used to express any conceivable algorithm.

  27. Structured Flow Chart Pseudocode Statement 1 Statement 2 While p do s Exit S1 S2 F P END T S

  28. Decision Table • Decision table can be used to specify complex decision logic in a high level software specification. • They are also useful for specifying algorithmic logic during detailed design. • Decision tables for recording complex decision logic . • Decision tables are widely used in data processing application and have an extensively developed literature.

  29. Programming Language • Any notation for the description of algorithm and data structure may be termed as a programming language. • We define a programming language as a systematic notation by which we can describe some computational process to others. • Here computational process means the steps or instructions that computer can understand to solve a particular problem. • using the constructs (constructs means different types of statements provided by a languages such as loops, conditional statements, arithmetic statements etc.) provided by a particular language, we can tell to the computer how to solve a particular problem.

  30. Need of studying programming language/Why to study programming language The following are the reasons or benefits of studying language concepts: • To improve your ability to develop effective algorithms. • Improved background for choosing appropriate languages or to allow a better choice of programming language. • Increased ability to learn new languages. • To increase your vocabulary of useful programming constructs. • To make it easier to design a new language. • Overall advancement of Computing

  31. Short History of Programming language • Programming language design and implementation method have evolved continuously since the earliest high level languages appeared in the 1950s. • Of the 12 languages described in some detail the first version of FORTRAN & LISP were designed during 1950s. • Ada ,c , Pascal, Prolog,and small talk date from the 1970s. • C++ , ML ,Perl, and post script date from 1980s. And JAVA date from 1990s

  32. Development in Programming Methodologies Numerically Based Language. Business Language. Artificial-intelligence language. Systems Language.

  33. Development in Programming Methodologies Numerically Based Language. Business Language. Artificial-intelligence language. Systems Language.

  34. Evolution of Software Architecture • The external environment supporting the execution of a program is termed its operating or target environment. . • The environment in which a program is being coded, designed, tested and debugged are host environment, may be different from the operating environment in which the program ultimately used. • The computing industry has now entered its third major era in the development of computer programs.

  35. Mainframe Era Batch Environment: • In this a program takes a set of data files as input, processes the data and produces and produces a set of output data files. • This operative environment is termed batch processing because the input data are collected and processed in batches. • Language such as FORTRAN, COBOL and PASCAL were initially designed for batch processing environment. Interactive Environment: • In an interactive environment a program interacts directly with a user at a display console during its execution , by alternately sending output to the display and receiving input from the keyboard or mouse.

  36. Personal Computer Era Personal Computer(1970 to 1980s) • The 1970c could be called the era of mini computer. These were progressively smaller and cheaper machine than mainframe era. Embedded Environment: • A computer system that is used to control part of larger system such as an aircraft, a machine tool and automobile or even your toaster is termed as embedded computer system. • Failure of an embedded application can often be life threatening ,C and C++ are used extensively to meet some of the special requirement of embedded system.

  37. Networking Era Distributed Computing • As machine became faster smaller and cheaper during 1980s they started to populate the business environment. • Companies would have central machines for handling corporate data and each department would have local machine for providing support to that department.(client server model) Internet • In 1990 the emergence of distributed LAN. • In 1970 DARPA started research project to link together mainframe computer. • Initially FTP and TELNET were the protocol which works in internet. • At the same time third protocol SMTP developed basis for to days email. • In 1980s Berns Lee developed concept of HTML.

  38. Stepwise refinement • StepwiseRefinement is a relatively old technique inSoftwareDesign that has been successfully used in a wide range  StructuredProgramming and ModularProgramming environments and languages. It is the procedural (step-by-step) form of SeparationOfConcerns • A systematic, iterative program design technique that unfortunately may lead to software that is hard to evolve • At each step, problem P decomposed into • sequence of subproblems: P1; P2; …Pn • a selection: if (cond) then P1 else P2 • an iteration: while (cond) do_something

  39. Examplederivation of selection sort Step 1 let n be the length of the array a to be sorted; i := 1 ; while i < n loop find the smallest of ai .. .an, and exchange it with the element at position i; i := i + 1; end loop;

  40. Step 2 let n be the length of the arraya to be sorted; i := 1 ; while i < n loop j := n; while j > i loop if a(i) > a(j) then interchange the elements at positions j and i ; end if; j := j - 1; end loop; i := i + 1; end loop;

  41. Step 3 • let n be the length of the array a to be sorted; • i := 1 ; • while i < n loop • j := n; • while j > i loop • if a(i) > a(j) then • x := a(i); • a(i) := a(j); • a(j) := x; • end if; • j := j - 1; • end loop; • i := i + 1; • end loop; • The advantage of StepwiseRefinement is that it allows or IncrementalDevelopment but on a much finer level of granularity

  42. Abstraction • At the highest level of abstraction – a solution is stated in broad terms • At lower level of abstraction – a more detailed description of the solution is provided. Two types of abstraction: • Procedural abstraction:Sequence of instructions that have a specific and limited function. Ex. Open a door open implies long sequence of activities (e.g. walk to the door, grasp knob, turn knob and pull the door, etc). • Data abstraction: collection of data that describes a data object. Ex. Open a door. – door is data object. • Data abstraction for door would encompass a set of attributes that describe the door. (E.g. door type, swing direction, opening mechanism, etc.)

  43. Characteristics are common to all design methods • A mechanism for the translation of analysis model into a design representation, • A notation for representing functional components and their interfaces. • Heuristics for refinement and partitioning • Guidelines for quality assessment.

  44. Design quality attributes • Acronym FURPS – • Functionality • Usability • Reliability • Performance • Supportability

  45. Functionality – is assessed by evaluating the feature set and capabilities of the program. • Functions that are delivered and security of the overall system. • Usability – assessed by considering human factors, consistency & documentation. • Reliability – evaluated by • measuring the frequency and severity of failure. • Accuracy of output results. • Ability to recover from failure and predictability of the program. • Performance - measured by processing speed, response time, resource consumption, efficiency. • Supportability – combines the ability to extend the program (extensibility), adaptability and serviceability.

  46. Integration testing • Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. • The objective is to take unit tested components and build a program structure that has been dictated by design. • The program is constructed and tested in small increments, where errors are easier to isolate and correct;

  47. Top-down Integration • Top-down integration testing is an incremental approach to construction of program structure. • Modules subordinate to the main control module are incorporated into the structure in either a depth-first or breadth-first manner. • Depth-first integration would integrate all components on a major control path of the structure. • Selection of a major path is somewhat arbitrary and depends on application-specific characteristics. • For example, selecting the left hand path, • Components M1, M2 , M5 would be integrated first. • Next, M8 or M6 would be integrated • The central and right hand control paths are built.

  48. Top down integration

  49. Top-down Integration process five steps: • The main control module is used as a test driver and stubs are substituted for all components directly subordinate to the main control module. • Depending on the integration approach selected (i.e., depth or breadth first), subordinate stubs are replaced one at a time with actual components. • Tests are conducted as each component is integrated • On completion of each set of tests, another stub is replaced with the real component. • Regression testing may be conducted to ensure that new errors have not been introduced. The process continues from step 2 until the entire program structure is built.

  50. Recommender system Search

More Related