Algorithms, Flowcharts & Program Design. ComPro



Similar documents
ALGORITHMS AND FLOWCHARTS. By Miss Reham Tufail

Algorithms, Flowcharts & Program Design

ALGORITHMS AND FLOWCHARTS

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Chapter 1 An Introduction to Computers and Problem Solving

Quotes from Object-Oriented Software Construction

Computer Programming

Glossary of Object Oriented Terms

Computer Programming Lecturer: Dr. Laith Abdullah Mohammed

2 SYSTEM DESCRIPTION TECHNIQUES

Chapter One Introduction to Programming

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages

KS3 Computing Group 1 Programme of Study hours per week

Fourth generation techniques (4GT)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Course MS10975A Introduction to Programming. Length: 5 Days

Flowchart Techniques

Unit I Page No. 1 System Development Object Basics Development Life Cycle Methodologies Patterns Frameworks Unified Approach UML

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Software Development. Topic 1 The Software Development Process

Chapter 8 Approaches to System Development

How To Develop Software

Assuming the Role of Systems Analyst & Analysis Alternatives

Creating, Solving, and Graphing Systems of Linear Equations and Linear Inequalities

Peter Mileff PhD SOFTWARE ENGINEERING. The Basics of Software Engineering. University of Miskolc Department of Information Technology

Exhibit F. VA CAI - Staff Aug Job Titles and Descriptions Effective 2015

How To Understand Programming Languages And Programming Languages

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Object Oriented Programming. Risk Management

Java Programming (10155)

Programmable Logic Controllers Definition. Programmable Logic Controllers History

CHAPTER 24 SOFTWARE PROJECT SCHEDULING. Overview

Software development life cycle. Software Engineering - II ITNP92 - Object Oriented Software Design. Requirements. Requirements. Dr Andrea Bracciali

OKLAHOMA SUBJECT AREA TESTS (OSAT )

Appendix M INFORMATION TECHNOLOGY (IT) YOUTH APPRENTICESHIP

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Java Application Developer Certificate Program Competencies

Flowcharting, pseudocoding, and process design

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

Total Quality Management (TQM) Quality, Success and Failure. Total Quality Management (TQM) vs. Process Reengineering (BPR)

Course Title: Software Development

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Software Design. Design (I) Software Design Data Design. Relationships between the Analysis Model and the Design Model

CSC 342 Semester I: H ( G)

Instructor Özgür ZEYDAN (PhD) CIV 112 Computer Programming

Chapter 6: Programming Languages

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

Johannes Sametinger. C. Doppler Laboratory for Software Engineering Johannes Kepler University of Linz A-4040 Linz, Austria

Fundamentals of Programming and Software Development Lesson Objectives

2014 New Jersey Core Curriculum Content Standards - Technology

Notes on Algorithms, Pseudocode, and Flowcharts

Software Design Document (SDD) Template

Axiomatic design of software systems

Programming and Software Development (PSD)

Curriculum Map. Discipline: Computer Science Course: C++

Chapter 1 Fundamentals of Java Programming

Introduction to Systems Analysis and Design

Chapter 12 Programming Concepts and Languages

Programming and Software Development CTAG Alignments

Instructor Özgür ZEYDAN BEU Dept. of Enve. Eng. CIV 112 Computer Programming Lecture Notes (1)

Fundamentals of Java Programming

Instructional Systems Design

Apache Web Server Execution Tracing Using Third Eye

Fundamentals of Information Systems, Fifth Edition. Chapter 8 Systems Development

Integer Operations. Overview. Grade 7 Mathematics, Quarter 1, Unit 1.1. Number of Instructional Days: 15 (1 day = 45 minutes) Essential Questions

Aspect-Oriented Programming

Computer Information Systems (CIS)

MAHATMA GANDHI UNIVERSITY SCHOOL OF DISTANCE EDUCATION (MGU CBCSS UG SDE 2012)

Masters of Science in Software & Information Systems

UML for the C programming language.

Candle Plant process automation based on ABB 800xA Distributed Control Systems

Click on the links below to jump directly to the relevant section

Module 1. Introduction to Software Engineering. Version 2 CSE IIT, Kharagpur

A Comparative Analysis of Structured and Object-Oriented Programming Methods ASAGBA, PRINCE OGHENEKARO; OGHENEOVO, EDWARD E. CPN, MNCS.

Programming Language Constructs as Basis for Software Architectures

1. Process Modeling. Process Modeling (Cont.) Content. Chapter 7 Structuring System Process Requirements

I PUC - Computer Science. Practical s Syllabus. Contents

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

Object-oriented design methodologies

Knowledge, Certification, Networking

COWLEY COLLEGE & Area Vocational Technical School

Java (12 Weeks) Introduction to Java Programming Language

Software Quality Factors OOA, OOD, and OOP Object-oriented techniques enhance key external and internal software quality factors, e.g., 1. External (v

Using UML Part One Structural Modeling Diagrams

Using Use Cases for requirements capture. Pete McBreen McBreen.Consulting

Specialized Programme on Web Application Development using Open Source Tools

ONLINE SUPPLEMENTAL BAPPENDIX PROJECT SCHEDULES WITH PERT/CPM CHARTS

Higher National Unit specification. General information. Software Development: Analysis and Design (SCQF level 7) Unit code: HA4C 34.

Vector storage and access; algorithms in GIS. This is lecture 6

CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA

Florida Math for College Readiness

Process / Operation Symbols

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Transcription:

Algorithms, Flowcharts & Program Design ComPro

Definition Algorithm: o sequence of steps to be performed in order to solve a problem by the computer. Flowchart: o graphical or symbolic representation of an algorithm (diagrammatic representation of the step-by-step solution to a given problem). Program Design: o steps a programmer should do before they start coding the program in a specific language. o Proper program design helps other programmers to maintain the program in the future.

Example The call-me algorithm: o When your train arrives, call my mobile phone. o Meet me outside the railway station. There are often many different algorithms to accomplish any given task. Each algorithm has advantages and disadvantages in different situations.

Reason Using Algorithm Efficiency: time, cost Abstraction: complicated problems can be distilled into simpler ones for which wellknown algorithms. Reusability: Algorithms are often reusable in many different situations.

Expressing Algorithms many different notations: natural languages, pseudocode, flowcharts. o Natural language: tend to be verbose and ambiguous (rarely used for complex algorithm). o Pseudocode and flowcharts: are structured ways, avoid many ambiguities common in natural language statements. Sometimes it is helpful in the description of an algorithm to supplement small flowcharts with natural language and/or arithmetic expressions written inside block diagrams to summarize what the flowcharts are accomplishing.

Example Algorithm using natural language statements: o Assume the first item is largest. o Look at each of the remaining items in the list and if it is larger than the largest item so far, make a note of it. o The last noted item is the largest item in the list when the process is complete. Algorithm using pseudocode: largest = La for each item in the list (Length (L) 1), do if the item largest, then largest = the item return largest

Benefits of Using Algorithms Reduces the task into a series of smaller steps of more manageable size. Problems can be approached as a series of small, solvable sub-problems. Efficient.

Flowcharts Flowchart is a type of diagram (graphical or symbolic) that represents an algorithm or process. Each step in the process is represented by a different symbol and contains a short description of the process step. The flow chart symbols are linked together with arrows showing the process flow direction. A flowchart typically shows the flow of data in a process.

Why Flowcharts Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. Flowcharts are generally drawn in the early stages of formulating computer solutions. Flowcharts often facilitate communication between programmers and business people.

Example Read X, Y, Z Compute Sum (S) as X + Y + Z Compute Average (A) as S / 3 Compute Product (P) as X x Y x Z

Advantages of Using Flowcharts Communication: a better way of logical communicating. Effective analysis: problem can be analysed in more effective way. Proper documentation. Efficient Coding: a guide or blueprint during the systems analysis and program development phase. Proper Debugging: helps in debugging process. Efficient Program Maintenance: easy with the help of flowchart

Limitations of Using Flowcharts Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy. Alterations and Modifications: If alterations are required the flowchart may require redrawing completely. Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.

Flowchart Symbols Terminator: Start or End Process Decision: Yes/No question or True/False Connector: jump in the process flow Data: data input or output (I/O) Delay Arrow: flow of control in a process.

Basic Symbol Name Symbol Use in Flowchart Oval Denotes the beginning or end of the program Parallelogram Denotes an input operation Rectangle Denotes a process to be carried out e.g. addition, subtraction, division etc. Diamond Denotes a decision (or branch) to be made. The program should continue along one of two routes. (e.g. IF/THEN/ELSE) Hybrid Denotes an output operation Flow line Denotes the direction of logic flow in the program

Example Terminator Process Decision Connector Data Delay Arrow

Example Terminator Process Decision Connector Data Delay Arrow

Ex. : convert the length in feet to centimeter Algorithm: o Step 1: Input Lft o Step 2: Lcm Lft x 30 o Step 3: Print Lcm Pseudocode: o Input the length in feet (Lft) o Calculate the length in cm (Lcm) by multiplying LFT with 30 o Print length in cm (LCM) Flowchart START Input Lft Lcm Lft x 30 Print Lcm STOP

Ex. : read the two sides of a rectangle and calculate its area START Algorithm o Step 1: Input W,L o Step 2: A L x W o Step 3: Print A Input W, L A L x W Print A Pseudocode STOP o Input the width (W) and Length (L) of a rectangle o Calculate the area (A) by multiplying L with W o Print A

Ex. : calculate the roots of a quadratic equation Equation: 2 ax bx c 0 Calculate: d = sqrt (b 2 4ac), and Roots: o x1 = ( b + d)/2a and o x2 = ( b d)/2a

Ex. Roots of Quadratic Eq. Algorithm: o Step 1: Input a, b, c o Step 2: d=sqrt (b b 4 a c) o Step 3: x1=( b + d) / (2 x a) o Step 4: x2=( b d) / (2 x a) o Step 5: Print x1, x2 Pseudocode: o Input the coefficients (a, b, c) o Calculate d o Calculate x1 o Calculate x2 o Print x1 and x2 START Input a, b, c d sqrt(b x b 4 x a x c) x 1 ( b + d) / (2 x a) X 2 ( b d) / (2 x a) Print x 1,x 2 STOP

Ex. Algorithm: o? START Input VALUE1,VALUE2 Pseudocode: o? Y MAX VALUE1 is VALUE1>VALUE2 N MAX VALUE2 Print The largest value is, MAX STOP

Program Design The phase of program development: o Determination of hardware and software resources needed by the program are identified and the logic to be used by the program. Program Design consists of the steps a programmer should do before they start coding the program in a specific language.

Activities in Program Design Understanding the Program (user need) System Analyst o variety of documentation items (include screen layouts, narrative descriptions, documentation showing, the processing steps, etc. o Understanding the purpose of a program (inputs, processing, outputs) Using Design Tools to Create a Model Develop Test Data

Test Data Test data consists of the user providing some input values and predicting the outputs. This can be quite easy for a simple program and the test data can be used to check the model to see if it produces the correct results.

Components of Program Design Problem definition, leading to a program specification, Modular program design, which refines the specification, Module composition, which translates specification into executable program, Module/program evaluation and testing, during which you refine the program and find errors, Program documentation, which pervades all other phases.

Approach The two most common ones are procedural programming and objectoriented programming. Procedures may use objects, and objects usually use procedures, called methods. The object-oriented code takes more planning and is significantly larger, but it is generally accepted to be easier.

Approach

Object-Oriented Formulations The process of creating an objectoriented (OO) formulation in program design involves at least three stages: o Object-Oriented Analysis (OOA), o Object-Oriented Design (OOD), and o Object-Oriented Programming (OOP).

Object-Oriented Analysis Find objects and classes o Create an abstraction of the problem domain. o Give attributes behaviours, classes, and objects meaningful names. o Identify structures pertinent to the system s complexity and responsibilities. o Observe information needed to interact with the system, as well as information to be stored. o Look for information re-use; are there multiple structures; can sub-systems be inherited? Define the attributes Define the behavior Diagram the system

Object-Oriented Analysis Find objects and classes Define the attributes o Select meaningful names. o Describe the attribute and any constraints. o What knowledge does it possess or communicate? o Put it in the type or class that best describes it. o Select accessibility as public or private. o Identify the default, lower and upper bounds. o Identify the different states it may hold. o Note items that can either be stored or re-computed. Define the behavior Diagram the system

Object-Oriented Analysis Find objects and classes Define the attributes Define the behavior o Give the behaviours meaningful names. o What questions should each be able to answer? o What services should it provide? o Which attribute components should it access? o Define its accessibility (public or private). o Define its interface prototype. o Define any input/output interfaces. o Identify a constructor with error checking to supplement the intrinsic constructor. o Identify a default constructor. Diagram the system

Object-Oriented Analysis Find objects and classes Define the attributes Define the behavior Diagram the system o Employ an OO graphical representation.

Object-Oriented Design Improve and add to the OOA results during OOD. Divide the member functions into constructors, accessors, agents and servers. Design the human interaction components. Design the task management components. Design the data management components. Identify operators to be overloaded. Identify operators to be defined. Design the interface prototypes for member functions and for operators. Design code for re-use through kind of and part of hierarchies. Identify base classes from which other classes are derived. Establish the exception handling procedures for all possible errors.

Object-Orientedness Object-based modular structure: o Systems are modularized on the basis of their data structure. Data Abstraction: o Objects should be described as implementations of abstract data types. Automatic memory management: o Unused objects should be de-allocated by the language system. Classes: o Every non-simple type is a module, and every high-level module is a type. Inheritance o A class may be defined as an extension or restriction of another. Polymorphism and dynamic binding: o Entities are permitted to refer to objects of more than one class and operations can have different realizations in different classes. Multiple inheritances: o Can declare a class as heir to more than one class.

Summary Algorithm is the sequence of steps to be performed in order to solve a problem by the computer. Three reasons for using algorithms are efficiency, abstraction and reusability. Algorithms can be expressed in many different notations, including natural languages, pseudocode, flowcharts and programming languages.

Summary Analysis of algorithms is the theoretical study of computer program performance and resource usage, and is often practised abstractly without the use of specific programming language or implementation. The practical goal of algorithm analysis is to predict the performance of different algorithms in order to guide program design decisions.

Summary Most algorithms do not perform the same in all cases; normally an algorithm s performance varies with the data passed to it. Typically, three cases are recognized: the best case, average case and worst case. Worst case analysis of algorithms is considered to be crucial to applications such as games, finance and robotics.

Summary Flowchart : diagrammatic representation of the step-bystep solution to a given problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. Benefits of using flowcharts include ease of communication, effective and efficient analysis and coding, proper documentation and maintenance. Limitations of using flowcharts include complex logic and multiple modifications.

Summary Program Design consists of the steps a programmer should do before they start coding the program in a specific language. Program design must be extremely structured, having the ultimate intentions of performing a specific calculation efficiently with attractive, understandable, efficient programs. Three broad areas of activities in program design: (1) Understanding the Program, (2) Using Design Tools to Create a Model and (3) Develop Test Data The process of creating an OO formulation in program design involves at three stages: 1) OOA, 2) OOD, and 3) OOP.