programming logic and design fourth edition introductory l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Programming Logic and Design Fourth Edition, Introductory PowerPoint Presentation
Download Presentation
Programming Logic and Design Fourth Edition, Introductory

Loading in 2 Seconds...

play fullscreen
1 / 34

Programming Logic and Design Fourth Edition, Introductory - PowerPoint PPT Presentation


  • 337 Views
  • Uploaded on

Programming Logic and Design Fourth Edition, Introductory. Chapter 3 Modules, Hierarchy Charts, and Documentation. Objectives. Describe the advantages of modularization Modularize a program Understand how a module can call another module Explain how to declare variables

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Programming Logic and Design Fourth Edition, Introductory' - elspeth


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
programming logic and design fourth edition introductory

Programming Logic and DesignFourth Edition, Introductory

Chapter 3

Modules, Hierarchy Charts, and Documentation

objectives
Objectives
  • Describe the advantages of modularization
  • Modularize a program
  • Understand how a module can call another module
  • Explain how to declare variables
  • Create hierarchy charts

Programming Logic and Design, Introductory, Fourth Edition

objectives continued
Objectives (continued)
  • Understand documentation
  • Design output
  • Interpret file descriptions
  • Understand the attributes of complete documentation

Programming Logic and Design, Introductory, Fourth Edition

modules subroutines procedures functions or methods
Modules, Subroutines, Procedures, Functions, or Methods
  • Module:
    • Unit of code that performs one small task
    • Called a subroutine, procedure, function, or method
  • Modularization: breaking a large program into modules

Programming Logic and Design, Introductory, Fourth Edition

modules subroutines procedures functions or methods continued
Modules, Subroutines, Procedures, Functions, or Methods (continued)
  • Advantages of modularization:
    • Provides abstraction
    • Allows multiple programmers to work simultaneously
    • Allows code reuse
    • Makes identifying structures easier

Programming Logic and Design, Introductory, Fourth Edition

modularization provides abstraction
Modularization Provides Abstraction
  • Abstraction:
    • Focusing on important properties while ignoring non-essential details
    • Avoids the low-level details and uses a high-level approach
    • Makes complex tasks look simple

Programming Logic and Design, Introductory, Fourth Edition

modularization provides abstraction continued
Modularization Provides Abstraction (continued)
  • A To-Do list

with abstraction: without abstraction:

Programming Logic and Design, Introductory, Fourth Edition

modularization allows multiple programmers to work on a problem
Modularization Allows Multiple Programmers to Work on a Problem
  • Large programming projects can be divided into modules
  • Modules can be written by different programmers
  • Development time is significantly reduced

Programming Logic and Design, Introductory, Fourth Edition

modularization allows you to reuse your work
Modularization Allows You to Reuse Your Work
  • Reusability: the ability to use modules in a variety of applications
  • Reliability: assurance that a module has been tested and proven to function correctly

Programming Logic and Design, Introductory, Fourth Edition

modularization makes it easier to identify structures
Modularization Makes It Easier to Identify Structures
  • Combining several tasks into modules may make it easier for beginning programmers to:
    • Determine if a program is structured
    • Identify structures in a program
  • Experienced programmers modularize for abstraction, ease of dividing the work, and reusability

Programming Logic and Design, Introductory, Fourth Edition

modularization makes it easier to identify structures continued
Modularization Makes It Easier to Identify Structures (continued)
  • Is this structured?

Programming Logic and Design, Introductory, Fourth Edition

modularization makes it easier to identify structures continued12
Modularization Makes It Easier to Identify Structures (continued)

Programming Logic and Design, Introductory, Fourth Edition

modularizing a program
Modularizing a Program
  • Most programs contain a main module
    • Contains the mainline logic
    • Accesses other modules or subroutines
  • Rules for module names used here:
    • Must be one word
    • Should be meaningful
    • Are followed by a set of parentheses

Programming Logic and Design, Introductory, Fourth Edition

modularizing a program continued
Modularizing a Program (continued)

Programming Logic and Design, Introductory, Fourth Edition

modularizing a program continued15
Modularizing a Program (continued)
  • Calling program (or calling module): one that uses another module
  • Flowchart symbol for calling a module: a rectangle with bar across the top
  • Flowchart for the module contains:
    • Module name in the start symbol
    • exit or return in the stop symbol
  • When a module is called, logic transfers to the model
  • When module ends, logic transfers back to the caller

Programming Logic and Design, Introductory, Fourth Edition

modularizing a program continued16
Modularizing a Program (continued)

Programming Logic and Design, Introductory, Fourth Edition

modules calling other modules
Modules Calling Other Modules

Programming Logic and Design, Introductory, Fourth Edition

modules calling other modules continued
Modules Calling Other Modules (continued)
  • Knowing when to break a module into its own subroutines or submodules is an art
  • Best practice: place together statements that contribute to one specific task
  • Functional cohesion: extent to which the statements contribute to the same task

Programming Logic and Design, Introductory, Fourth Edition

declaring variables
Declaring Variables
  • Declaring a variable involves:
    • Providing a name for the memory location where the value will be stored
    • Specifying the type of the data
  • Data types used here:
    • num for number values
    • char for all other values
  • Where and when a variable must be declared is language-dependent

Programming Logic and Design, Introductory, Fourth Edition

declaring variables continued
Declaring Variables (continued)
  • Local variables: declared within a module
  • Global variables: declared at the beginning of the program, and used in all modules
  • Annotation box: flowchart symbol containing notes
  • Data Dictionary: list of variables used in a program, with their type, size, and description

Programming Logic and Design, Introductory, Fourth Edition

declaring variables continued21
Declaring Variables (continued)

Programming Logic and Design, Introductory, Fourth Edition

creating hierarchy charts
Creating Hierarchy Charts
  • Hierarchy chart:
    • Illustrates modules’ relationships
    • Tells which routines call which other routines
    • Does not tell when or why the modules are called

Programming Logic and Design, Introductory, Fourth Edition

creating hierarchy charts continued
Creating Hierarchy Charts (continued)
  • Blackened corner indicates a module that is used more than once

Programming Logic and Design, Introductory, Fourth Edition

understanding documentation
Understanding Documentation
  • Documentation:
    • All supporting material that goes with a program
    • Two major categories: for users and for programmers
    • Usually created by system analysts and/or tech writers
    • May be printed or electronic (Web or CD)
  • End users: people who use computer programs
  • Program Documentation:
    • Internal program documentation: comments within code
    • External program documentation: supporting paperwork written before programming begins

Programming Logic and Design, Introductory, Fourth Edition

output documentation
Output Documentation
  • Usually written first
  • Represents the information needed by end users
  • May be initially created by end users
  • Printed reports: designed using a print chart

Programming Logic and Design, Introductory, Fourth Edition

output documentation continued
Output Documentation (continued)
  • Printed reports usually contain:
    • Detail lines: display data details
    • Heading lines: contain title and column headings
    • Total (or summary) lines: may contain statistics or end of report indicators
  • Printed reports may contain only summary information
  • Reports may be displayed on screens and not printed
  • GUI: graphical user interface

Programming Logic and Design, Introductory, Fourth Edition

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

Programming Logic and Design, Introductory, Fourth Edition

input documentation continued
Input Documentation (continued)
  • Byte: unit of computer storage that can contain any of 256 combinations of 0s and 1s to represent characters
  • Programmers usually create one variable for each data field in an input file
  • Some report fields may be calculated results

Programming Logic and Design, Introductory, Fourth Edition

input documentation continued29
Input Documentation (continued)
  • Programmers need to know:
    • Data file name
    • Data fields and their order within the file
    • Data types of each field

Programming Logic and Design, Introductory, Fourth Edition

input documentation continued30
Input Documentation (continued)

Programming Logic and Design, Introductory, Fourth Edition

slide31

Completing the Documentation

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

Programming Logic and Design, Introductory, Fourth Edition

completing the documentation continued
Completing the Documentation (continued)
  • User documentation:
    • Written clearly in plain language
    • Usually prepared by system analysts and/or tech writers
  • User documentation usually indicates:
    • How to prepare input
    • Output distribution
    • Output interpretation
    • Error message information
    • Run frequency

Programming Logic and Design, Introductory, Fourth Edition

summary
Summary
  • Modules, subroutines, procedures, functions, methods: smaller, reasonable units of code that provide reusability
  • Modules can call other modules
  • Variable declarations define the name and type of the data to be stored
  • Hierarchy chart illustrates modules’ relationships
  • Documentation: all supporting material for a program

Programming Logic and Design, Introductory, Fourth Edition

summary continued
Summary (continued)
  • Output documentation: includes report designs
  • File description: details data types and lengths of each field of data in the file
  • User documentation: includes manuals and instructional materials for non-technical people, and operating instructions for operators and data-entry people

Programming Logic and Design, Introductory, Fourth Edition