IMSE Lecture Week 6 - Low Level Design Summary of last week: u Transform Analysis - 4 steps: 1 annotate the DFD (without redrawing it) 2 draw the intermediate.

Slides:



Advertisements
Similar presentations
Lecture 7: Software Design (Part II)
Advertisements

Chapter 10: The Traditional Approach to Design
Systems Analysis and Design in a Changing World, Fifth Edition
PROBLEM SOLVING TECHNIQUES
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
Introduction to Flowcharting
Introduction to Flowcharting
An Object-Oriented Approach to Programming Logic and Design
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Fundamentals of Algorithms MCS - 2 Lecture # 4
Programming Logic and Design, Third Edition Comprehensive
ITEC113 Algorithms and Programming Techniques
Chapter 2- Visual Basic Schneider
1 © University of Sunderland IMSE Lecture 4 u so far all our structure charts have been produced from an English description, e.g. - night on the town.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
Chapter 2: Algorithm Discovery and Design
Jump to first page 1 System Design (Finalizing Design Specifications) Chapter 3d.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
Chapter 2: Algorithm Discovery and Design
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1 Program Design
Chapter 2: Algorithm Discovery and Design
Chapter 3 Planning Your Solution
The Program Design Phases
(C)opyright 2003 Scott/Jones Publishers Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Scott/Jones Publishers.
PRE-PROGRAMMING PHASE
Fundamentals of C programming
ALGORITHMS AND FLOWCHARTS
CSC103: Introduction to Computer and Programming
Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 5 Structured Program.
System Implementation System Implementation - Mr. Ahmad Al-Ghoul System Analysis and Design.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Chapter 12: How Long Can This Go On?
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
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.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Flowcharts and Algorithms. Review of Terms  A computer is a machine that can represent and manipulate data –Ultimately the data and the instructions.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
Lecture 5: Stopping with a Sentinel. Using a Sentinel Problem Develop a class-averaging program that will process an arbitrary number of grades each time.
CS 100 Introduction to Computing Seminar October 7, 2015.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Introduction to C Programming CE Lecture 5 Program Design in C.
Systems Design.  Application Design  User Interface Design  Database Design.
Programming Logic and Design Fifth Edition, Comprehensive
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
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.
SYSTEM ANALYSIS AND DESIGN SAFAA S.Y. DALLOUL. DESIGN THE PROGRAM.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
 Problem Analysis  Coding  Debugging  Testing.
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Introduction To Flowcharting
Introduction to Algorithm – part 1
ALGORITHMS AND FLOWCHARTS
Chapter 16 Component-Level Design
Program Design Introduction to Computer Programming By:
JSP (Jackson Structured Programming)
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
ICT Gaming Lesson 2.
Presentation transcript:

IMSE Lecture Week 6 - Low Level Design Summary of last week: u Transform Analysis - 4 steps: 1 annotate the DFD (without redrawing it) 2 draw the intermediate diagram 3 draw the first cut structure chart 4 refine the structure chart u We’ve covered the first 3 steps so far

Delaying Step 4 u step 4 (refining the structure chart) must be delayed u first we need to think about low-level design issues u long diversion needed before we can produce a final refined structure chart for the system

High Level Design u high level design documents such as structure charts show: - the overall system design - how the program is decomposed into separate modules - which modules call which other ones - how they communicate via data and flags u they do not show: - the order in which the modules are called - the number of times they are called if it’s more than once - the condition(s) determining optional/conditional invocation - the internal workings of the modules

Low Level Design u Also known as procedural or functional design: - the design of the internal workings of a module - the design of the internal workings of a module - the fine details of the system - the fine details of the system - adds to the high level design - adds to the high level design - details kept separate from the high level design, for clarity - details kept separate from the high level design, for clarity u 4 main methods: - pseudo code (most popular nowadays) - pseudo code (most popular nowadays) - JSP - JSP - flow charts - flow charts - Nassi-Shneiderman diagrams - Nassi-Shneiderman diagrams

3 Basic Constructs u all these 4 main methods of producing low-level design documents are based on 3 basic constructs: - sequence - selection - iteration u all the internal logic of our modules can be expressed using only these 3 constructs

Pseudo code u Use of words rather than diagrams, good but not visual u More closely resembles the coded-up module u various terminology exists, e.g.FUNCTION, procedure, loop until, while … we will use COM168 version. if sex = male write “Mr.” else write “Ms.” ifend write name

JSP u Original concepts developed by Dijkstra, but made popular by Michael Jackson in the JSP method * repetition u Show logical order and control of processing selection o o o o

Nassi-Shneiderman abstract example do this do this then this then this while true while true T if this is true F T if this is true F do this do this while true do this while true do this finally do this finally do this

Flow charts u traditional method, now out of favour u the reason is because flow charts do not enforce good design practices, as they may produce modules with very poor flow of control, i.e. “spaghetti code” u again based on the 3 basic constructs, sequence, selection and iteration

Flow chart - sequence 1st task add 10 2 tasks, performed to a sequentially, e.g. to a sequentially, e.g. a = a + 10 a = a nd task deduct b = b from b 2 from b

Flow chart - selection e.g. e.g.condition T F T F if k > max if k > max write “k > max” write “k > max” then else else part part write “k <= max” ifend ifend T and F may be right, left or below the diamond, and the then or else part may be directly below the diamond - wherever works best T and F may be right, left or below the diamond, and the then or else part may be directly below the diamond - wherever works best

Flow chart - iteration (e.g. for, while) e.g. deduct 1 loop while k > min deduct 1 loop while k > min from k write k from k write k loop k = k-1 loop k = k-1 tasks loopend tasks loopend print k print k k > T k > T min loop condition min loop condition F

Flow chart - iteration (e.g. do while, or repeat until) e.g. loop loop loop tasks print k k = k-1 loopend when k <= min loopend when k <= min k>min k>min loop T loop T condition conditionF

Flow chart - selection (e.g. else if, case) k > T print k > 100 e.g. k > T print k > 100 e.g F if k > 100 F if k > 100 k > T print k > 50 write “k > 100” k > T print k > 50 write “k > 100” 50 elseif k > elseif k > 50 F write “k > 50” F write “k > 50” elseif k > 0 elseif k > 0 k > T print k > 0 write “k > 0” k > T print k > 0 write “k > 0” 0 ifend 0 ifend F

Pseudocode and Stepwise Refinement - Top Mark Example u using pseudocode and stepwise refinement design the internal details of a single module whose role is to find the top mark from a set of marks terminated with 999 u 2 general principles: –design the algorithm in steps, and always walk through it with test data after each refinement –when designing algorithms with loops always take care with pre-loop initialisationpre-loop initialisation always exiting from the loopalways exiting from the loop post-loop tidying uppost-loop tidying up u NB there will almost always be more than one correct solution

Step 1 initialisations initialisationsloop read mark read mark if mark > max if mark > max max <- mark max <- mark endif endif loopend when mark = 999 write max u decompose into 3 parts - start up, process, end u always leave initialisations until after the main processing is clearer u after clarifying the main processing and walking through it with some test data we see that step 2 needs to include the initialisation of max

Step 2 max = 0 max = 0loop read mark read mark if mark > max if mark > max max <- mark max <- mark endif endif loopend when mark=999 write max u this looks good, but provides us with an unreliable algorithm u it would not always give the correct result - walk through the algorithm with all negative marks - the max mark would be incorrectly displayed as 0 u a more reliable algorithm needs to be designed, to cater for unlikely possibilities which may one day happen

Step 3 read 1st mark read 1st mark max = 1st mark max = 1st markloop if mark > max if mark > max max <- mark max <- mark endif endif read next mark read next mark loopend when mark = 999 write max u this looks better, but is still not perfect u walk through the algorithm with an empty set of marks u the max mark would be incorrectly set to 999 u the loop would never exit (common error) as processing would stop at input next mark

Final Level of Refinement read 1st mark read 1st mark max = 1st mark max = 1st mark loop while mark not equal to 999 if mark > max if mark > max max <- mark max <- mark endif endif read next mark read next markloopend if max not equal to 999 write max write max endif endif u solution uses sequence, selection and repetition u common mistake in previous steps - listing some of the component parts in the wrong order -the 1st mark was originally input inside the loop -loop condition was tested at the end, not the start of the loop u walking through with test data at each step helps find correct ordering u final algorithm is now fully designed and ready to be coded up