Chapter 2: Modularization

Slides:



Advertisements
Similar presentations
P5, M1, D1.
Advertisements

Chapter 3: Modules, Hierarchy Charts, and Documentation
Chapter 3: Modularization
Modules, Hierarchy Charts, and Documentation
Programming Logic and Design Fourth Edition, Introductory
Chapter 1 - An Introduction to Computers and Problem Solving
Programming Logic and Design, Third Edition Comprehensive
Programming Logic and Design Fourth Edition, Introductory
Program Design and Development
Program Flow Charting How to tackle the beginning stage a program design.
Writing a Complete Program
Chapter 2: Input, Processing, and Output
Modules, Hierarchy Charts, and Documentation
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Understanding the Mainline Logical Flow Through a Program (continued)
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming Logic and Design Fourth Edition, Introductory
An Overview of Computers and Programming
- Meeting 4 – Writing a Complete Program
CS102 Introduction to Computer Programming
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
Structured COBOL Programming, Stern & Stern, 9th edition
Programming Logic and Design Sixth Edition Chapter 2 Working with Data, Creating Modules, and Designing High-Quality Programs.
Simple Program Design Third Edition A Step-by-Step Approach
Planning for the Solution
chap13 Chapter 13 Programming in the Large.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Programming Logic and Design Fifth Edition, Comprehensive
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
SE: CHAPTER 7 Writing The Program
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
6 Chapter 61 Looping Programming Logic and Design, Second Edition, Comprehensive 6.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Programming Logic and Design Using Methods. 2 Objectives Review how to use a simple method with local variables and constants Create a method that requires.
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
Programming Logic and Design Seventh Edition
Chapter 10 Software Engineering. Understand the software life cycle. Describe the development process models. Understand the concept of modularity in.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
1 Program Planning and Design Important stages before actual program is written.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
The Hashemite University Computer Engineering Department
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
MIT App Inventor Lesson 3 Algorithms Variables Procedures.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 7 Using Methods.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Introduction to Algorithms
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Functions, Procedures, and Abstraction
Programming Logic and Design Fourth Edition, Comprehensive
Introduction to Algorithms
Writing a Complete Program
Topics Introduction to Functions Defining and Calling a Function
Modules, Subroutines, Procedures, Functions, or Methods
Chapter 4: Writing and Designing a Complete Program
Programming Logic and Design Eighth Edition
Presentation transcript:

Chapter 2: Modularization

Objectives Understanding Documentation Learn about documentation Learn about the advantages of modularization Learn how to modularize a program Declare local and global variables and constants Create hierarchy charts

Documentation Documentation Documentation refers all supporting material that goes with a program Two major categories: for users and for programmers User Documentation: End users (people who use computer programs) Program Documentation falls into two categories: Internal program documentation include comments within code External program documentation include supporting paperwork written before programming begins

Output Documentation Output documentation is usually the first to be written. user who requested output generally present to programmer with an example. Figure 3-2 Inventory records displayed in a GUI environment Figure 3-3 Inventory records displayed in a running program

Printer Spacing Chart Chapter 3

Printer Spacing Chart with Title and Column Headings

Input Documentation Describes what input is available to produce the output File description: Describes data stored in a file Indicates fields, data types, and lengths

Completing Documentation Program documentation may contain: Output design Input description Flowcharts Pseudocode Program code listing User documentation may contain: Manuals Instructional material Operating instructions

Modularization Modularization: breaking a large program into modules Advantages of modularization: Provides abstraction Allows multiple programmers to work simultaneously Allows code reuse Makes identifying structures easier

Modularizing a Program- Flowchart Symbols Chapter 3 Sentinel Symbols A module has it own sentinel symbols (Start and End) The Start symbol has the name of the module The End symbol has the word “RETURN”

Modularized Logic from a Payroll Program Chapter 3

Modularization Provides Abstraction Focuses on important properties while ignoring non- essential details Avoids low-level details Makes complex tasks look simple High-level programming languages allow English-like vocabulary One statement corresponds to dozens of machine instructions Modules provide another way to achieve abstraction

Modularization Provides Abstraction (continued) To-do list without abstraction Pick up laundry basket Put laundry basket in car Drive to laundromat Get out of car with basket Walk into laundromat Set basket down . . . To-do list with abstraction Do laundry Call Aunt Nan Start term paper

Modularization Allows Multiple Programmers to Work on a Problem Commercial programs rarely written by a single programmer Development time is significantly reduced Large programming projects can be divided into modules Modules can be written by different programmers or programming teams

Modularization Allows You to Reuse Your Work Subroutines that are useful should be used more than once in a program Example: routine that checks the current date Instructions placed in their own module are easy to port to other applications Reusability: the ability to use modules in a variety of applications Reliability: assurance that a module has been tested and proven to function correctly Reliable software saves times and money

Understanding the Mainline Logic for Many Procedural Programs Mainline logic of most procedural programs follows same general structure: Housekeeping tasks Variable and constant declarations Opening files Main loop tasks Processes that must occur for every data record End-of-job tasks Print footer lines Close open files

Understanding the Mainline Logic for Many Procedural Programs (continued) Figure 3-16 Flowchart and pseudocode of mainline logic for a typical procedural program

An Organizational Hierarchy Chart

Local and global variable Local These variables only exist inside the specific function that creates them. They are unknown to other functions and to the main program. scope is limited to that function. Global These variables can be accessed (ie known) by any function comprising the program

Example of local variable main() { int i=4; i++; }

Example of global variable int i=4; main() { i++; }

int i=4; /. Global definition. / main() { i++; /. global variable int i=4; /* Global definition */ main() { i++; /* global variable */ func } func() { int i=10; /* Internal declaration */ i++; /* Internal variable */