Lecture 7: Software Design (Part II)

Slides:



Advertisements
Similar presentations
4 Control Statements: Part 1.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 1.
Writing Pseudocode And Making a Flow Chart A Number Guessing Game
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
Lecture 10 Flow of Control: Loops (Part 2) COMP1681 / SE15 Introduction to Programming.
DT266/2 Information Systems COBOL Revision. Chapters 1 & 2 Hutty & Spence Divisions of a Cobol Program Identification Division Program-ID. Environment.
Week 2 The Object-Oriented Approach to Requirements
Algorithms 10 IST – Topic 6.
1 1 Mechanical Design and Production Dept, Faculty of Engineering, Zagazig University, Egypt. Mechanical Design and Production Dept, Faculty of Engineering,
1 University of Utah – School of Computing Computer Science 1021 "Thinking Like a Computer"
Lecture 1: Software Engineering: Introduction
Lecture 3: Software Process Models Dr Valentina Plekhanova University of Sunderland, UK
Lecture 8: Testing, Verification and Validation
Lecture 6: Software Design (Part I)
Lecture 5: Requirements Engineering
CS101: Introduction to Computer programming
Project 6: Working with If Statements Essentials for Design JavaScript Level One Michael Brooks.
CS 240 Computer Programming 1
Chapter 10: The Traditional Approach to Design
Systems Analysis and Design in a Changing World, Fifth Edition
More on Algorithms and Problem Solving
Types of selection structures
Chapter 11 Describing Process Specifications and Structured Decisions
Algorithms An algorithm is a finite sequence of instructions, logic, an explicit step-by-step procedure for solving a problem. Specific algorithms sometimes.
How Are Algorithms Developed?
PSEUDOCODE & FLOW CHART
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
ITEC113 Algorithms and Programming Techniques
Program Design and Development
Chapter 1 Program Design
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
Chapter 3 Planning Your Solution
The Program Design Phases
Review Algorithm Analysis Problem Solving Space Complexity
Fundamentals of C programming
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
Simple Program Design Third Edition A Step-by-Step Approach
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Lecture 2 Numerical Methods for Engineering MECN 3500 Department of Mechanical Engineering Inter American University of Puerto Rico Bayamon Campus Dr.
ITEC113 Algorithms and Programming Techniques
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
CMSC 104: Peter Olsen, Fall 99Lecture 9:1 Algorithms III Representing Algorithms with pseudo-code.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
ICS124 Session 9 Flowcharting 1. By the end of this section the student will be able to:  Name the three structures of the Structure Theorem  Identify.
Fundamentals of Algorithms MCS - 2 Lecture # 3. Representation of Algorithms.
Program Program is a collection of instructions that will perform some task.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
 Problem Analysis  Coding  Debugging  Testing.
Program design Program Design Process has 2 phases:
Learning outcomes 5 Developing Code – Using Flowcharts
ALGORITHMS AND FLOWCHARTS
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Algorithms and Flowcharts
Lecture 2 Introduction to Programming
Introduction To Flowcharting
Introduction to Computer Programming
Programming Fundamentals
Unit# 9: Computer Program Development
ALGORITHMS AND FLOWCHARTS
Structured Program
Flowcharts and Pseudo Code
Presentation transcript:

Lecture 7: Software Design (Part II) Dr Valentina Plekhanova University of Sunderland, UK http://www.cet.sunderland.ac.uk/~cs0vpl/SE-Com185.htm

Low-level Design Also known as procedural or functional design: the design of the internal workings of a module; the fine details of the system; adds to the high level design details kept separate from the high level design, for clarity. Lecture 7 Valentina Plekhanova

Low-level Design If our designs are good, each procedure or function will only be required to carry out a fairly small and specific subtask. We now need to consider the design of the code that will carry out each of the identified subtasks. Once that is done, it should be fairly easy to translate each low-level design into program code. Lecture 7 Valentina Plekhanova

Low-level Design The actual choice of design representation to use is not important, designers have their own favourite methods. It is a matter of individual choice (unless you work for an organisation that imposes a particular design representation) as to the method of design representation you use to design low-level code. What all low-level design representation methods do is to portray in a way that is not specific to any one programming language. Lecture 7 Valentina Plekhanova

Low-level Design define input data; assign data to a variable; define output data from the module; define another (sub-) modules that can be 'called up' from this module. Lecture 7 Valentina Plekhanova

Low-level Design 4 main methods: pseudo code flow charts JSP Nassi-Shneiderman diagrams Lecture 7 Valentina Plekhanova

Low-level Design:Basic Constructs All these 4 main methods of producing low-level design documents are based on 3 basic constructs: sequence; selection; iteration (repetition) . Lecture 7 Valentina Plekhanova

Low-level Design Sequence is a linear progression where one task is performed sequentially after another. Iteration: WHILE is a loop with a simple conditional test at its beginning. Selection: IF-THEN-ELSE is a decision in which a choice is made between two alternative courses of action. Lecture 7 Valentina Plekhanova

Low Level Design Although these constructs are sufficient, it is often useful to include three more constructs: REPEAT-UNTIL is a loop with a simple conditional test at the bottom. FOR is a special loop in which an index variable is automatically initialised, incremented, and tested. CASE is a multiway branch (decision) based on the value of an expression. CASE is a generalisation of IF-THEN-ELSE. Lecture 7 Valentina Plekhanova

Basic Sections There are usually 3 sections to all Low-level designs: initialisation, processing, and termination. Lecture 7 Valentina Plekhanova

Low Level Design: Initialisation Initialisation section includes opening files, reading the first record, and, if necessary, printing page and report headings. Lecture 7 Valentina Plekhanova

Low Level Design: Processing Processing section includes DO statements to show repetitive tasks that are performed on each record in the file – there are two ways to show this loop: DO while data remains Processing steps Read next record END DO Lecture 7 Valentina Plekhanova

Low Level Design: Processing DO until end-of-file Processing steps Read next record END DO Lecture 7 Valentina Plekhanova

Low Level Design: Termination Termination section includes what happens at the very end of the program, such as closing the files and stopping the program. Lecture 7 Valentina Plekhanova

What is Pseudocode? Pseudocode is simply a way of describing the steps to the solution of a programming task, using a few English words in a structured way, though not in any particular programming language. Instead, or in combination, we can use program flowcharts. Lecture 7 Valentina Plekhanova

Pseudocode: Important Notes Each textbook and each individual designer may have their own personal style of pseudocode. Pseudocode is not a rigorous notation, since it is read by other people, not by the computer. There is no universal "standard" for the industry, but for instructional purposes it is helpful if we all follow a similar style. Lecture 7 Valentina Plekhanova

Examples of Pseudocode: Example 1 - The problem is to find the roots of a quadratic equation. Step 1 Prompt for and read the coefficients a, b, and c Step 2 If a = 0, do steps 3,4 Step 3 If b = 0 also, Error message: "no roots" and exit Step 4 Write single root -c/b and exit Step 5 Set d = b^2 - 4*a*c and if d < 0 Error message: "not real" and exit Step 6 Set s = -(b + sqrt(d)*sign(b))/2 Step 7 Set x1 = s/a. Write this first (robust) root Step 8 Set x2 = c/s. Write this second (robust) root. Step 9 Set x3 = -(b - sqrt(d)*sign(b))/(2*a). Write this second (risky) root. Lecture 7 Valentina Plekhanova

Example 2: Pseudocode prompt the user to input the number of days; user inputs the number of days; multiply the number of days by 7 hours; display the total hours with an output prompt. Lecture 7 Valentina Plekhanova

Low-level Design: Flow charts A flowchart is a pictorial representation of the logic in a computer program Based on the 3 basic constructs, sequence, selection and iteration. In flow chart, certain shapes have special meaning, and arrows are used to connect pieces of the flowchart. Lecture 7 Valentina Plekhanova

Low-level Design: Flow charts Used to indicate the beginning (start) or end (stop) of a computer program or subroutine. Used to indicate some type of input or output, such as opening or closing Files. Also known as a decision symbol, this is used to indicate a decision to be made, choices based on logic – an “if” statement Arrows are used to show the flow of the program – to show where the next item is located. Lecture 7 Valentina Plekhanova

Some Examples: Pseudocodes & Flow Charts Lecture 7 Valentina Plekhanova

Flow chart – Sequence Sequential control is indicated by writing one action/task after another, each action/task on a line by itself, and all actions/tasks aligned with the same indent. The actions/tasks are performed in the sequence (top to bottom) that they are written. Lecture 7 Valentina Plekhanova

Flow chart – Selection: IF-THEN-ELSE Binary choice on a given Boolean condition is indicated by the use of four keywords: IF, THEN, ELSE, and ENDIF. The general form is: IF condition THEN sequence 1 ELSE sequence 2 END IF The ELSE keyword and "sequence 2" are optional. If the condition is true, sequence 1 is performed, otherwise sequence 2 is performed. Lecture 7 Valentina Plekhanova

Flow chart – Selection: IF-THEN-ELSE Example IF hours > 35 THEN Display overtime message ELSE Display regular time message END IF Lecture 7 Valentina Plekhanova

Flow chart - Iteration (e.g. for, while) This loop is a specialised construct in which an index variable is automatically initialised, incremented and tested. Two keywords, FOR and END FOR are used. Example: The general form is: FOR index = start to finish sequence END FOR At the initiation of the loop, the index variable is set to the starting value. At the end of each iteration, the index variable is automatically incremented. The loop repeats until the index value reaches the finish value. Lecture 7 Valentina Plekhanova

Flow chart - Iteration: WHILE The WHILE construct is used to specify a loop with a test at the top. The beginning and ending of the loop are indicated by two keywords WHILE and END WHILE. The general form is: WHILE condition sequence END WHILE Example: WHILE number of days < 6 Compute hours as number of days * hours Lecture 7 Valentina Plekhanova

Flow chart - Iteration: WHILE The loop is entered only if the condition is true. The "sequence" is performed for each iteration. At the conclusion of each iteration, the condition is evaluated and the loop continues as long as the condition is true. Lecture 7 Valentina Plekhanova

Low-level Design: Important Notes Time spent on the design stage of the development cycle will lead to less time spent on testing, debugging and re-writing your programs to make them work properly. Lecture Notes are based on materials taken from Books: Pfleeger; Sommerville; Vliet (see References Site). Lecture 7 Valentina Plekhanova

Week 8: 24.04.2003-28.04.2003 Project Control Session Tutorial Time: 10 minutes for each Team Students will present project file, particularly Schedule, plus any project documentation. Students will describe where they are in the project and any problems encountered. During the discussion reviewers will ask to see evidence of deliverables for any tasks that are complete to determine whether they have in fact been done. Lecture 7 Valentina Plekhanova