Program Design and Flowcharting - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Program Design and Flowcharting

Description:

If they can't do without you, you may not get fired, but you won't get ... Demonstrative naming conventions. Consistency in naming. Clear internal documentation ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 39
Provided by: waynem8
Category:

less

Transcript and Presenter's Notes

Title: Program Design and Flowcharting


1
Program Design and Flowcharting
  • Bringing Professionalism to the DetailsOr
  • How to Get a Better Grade in This Class.

2
Proper Program Design Is Important
  • Reduce program development time
  • Reduce programming logic errors
  • Increase your productivity
  • Increase your "promote-ability"
  • If they cant do without you, you may not get
    fired, but you wont get promoted either!

3
Proper Design Consists of Five Features
  • Structured designed techniques.
  • Proper documentation.
  • Internal and external
  • Creating Task-Object-Event (or TOE) charts.
  • Consistency in form and function.
  • Exit buttons are identical and appearance and
    function.
  • Flowcharting the logic.

4
1. Structured Design
  • A Systematic Approach to ProgrammingorMaking
    Your Life Easy

5
Why Structured Design?
  • First, lets identify the five phases of program
    development.
  • Conception phase.
  • Analysis phase.
  • Programming phase.
  • Testing phase.
  • Implementation phase.

6
a. Conception Phase
  • A need is determined.
  • Something is lacking in the current system.
  • The user has a new or specific request.
  • Important to understand the system as a whole.
  • Is the information already available in another
    form?
  • Is there appropriate data to satisfy the request?
  • What exactly is the user looking for?

7
b. Analysis Phase
  • We agree that a new program needs to be built.
    Now, how are we going to do this?
  • What data is needed?
  • From where will the data come?
  • How shall the information be presented? Form?
    Report? Other?
  • What features will the program need? Command
    buttons? Text boxes? Etc.

8
In the Analysis Phase, We Follow a Formal
Structure Design
  • Modularization of techniques.
  • VB lends itself well to modularization. In VB,
    each event initiates a specific module of code.
  • Modularization allows for consistency between
    programs.
  • It also allows code to be lifted from one
    program and copied into another with minimal
    changes.

9
Most Logic Errors Are Located in This Phase
  • During the analysis phase we create preliminary
    flowcharts and TOE charts.
  • Charting helps us to think clearly through the
    problem.
  • It also helps us to map the programflow and
    locate situations we may not have thought of.

Nice grammar, eh?
10
c. Programming Phase
  • Now we can create the actual program
  • Create the VB code necessary to perform the task.
  • Some programming come to this step first, but at
    their peril.
  • Old carpenters adage Measure twice, cut once

11
Programmer Awareness
  • For your own benefit and for the benefit of those
    who will follow you
  • Use structured programming techniques
  • Top-down programming
  • Single entry / single exit modules
  • Demonstrative naming conventions
  • Consistency in naming
  • Clear internal documentation

12
Remember You Will Not Be the Only Person Looking
at Your Code.
  • Your boss will. Your co-workers will. And I will.
  • If your code is clean, your work and opinions
    will be respected.
  • If your code is not, well what do you expect?
  • Consistency, clarity, and documentation will help
    those to look at your code to understand what you
    are doing.

13
d. Testing Phase
  • Testing actually occurs all along the programming
    phase. Instead of writing all of the code and
    testing all at once, you write some and test it
    then write some more.
  • Large systems usually go through a series of
    testing phases before going live.
  • Sometimes beta test at the users location.

14
Testing Techniques
  • Use live data whenever possible.
  • Programmers tend to use data that will cause the
    program to always work.
  • Test on the people who will actually be using the
    program (duh but often missed).
  • No one knows the job better than the person who
    does the job.
  • Test to find failure not success.
  • Bullet-proofing the program.

15
e. Implementation Phase
  • Shut-Down / Start-Up
  • Come in Monday morning to a whole new system
  • Great motivator for success(you have no choice)
  • No turning back
  • Bad if new system fails

Old
New
16
Implementation Phase
  • Phase-in.
  • New system installed a littleat a time.
  • Many parts of the old systemstill function.
  • Good because permits parts of larger systems to
    go in sooner.
  • Bad because new system must interface with the
    old system which you want to replace.
  • Bad structures hang on.
  • Or need to create interface modules.

Old
New
17
Implementation Phase
  • Parallel systems
  • New system and old runsimultaneously
  • Good for mission criticalsystems
  • If survival is dependant on the systems and there
    is a possibility that the new system may not be
    fully functional
  • Bad if have to duplicate data entry and data
    tracking
  • Also bad because it gives the users an
    opportunity to kill the new system without
    sufficient testing

New
Old
18
As the designer, it is your decision as to which
approach is appropriate for your immediate needs.
Old
New
New
Old
Old
New
19
Structured Programming Advantages
  • Structured programming reduces development time
    through consistent techniques
  • Structured programming reduces testing time
    through easier programming management

Development Time
You may not reduce the size of the slices, but
you will reduce the size of the pie!
20
2. Documentation
  • Recording What You Do

21
Documentation The Missing Phase
  • Documentation is information written and
    maintained about the program or system.
  • It usually consists of descriptions and
    explanations of what the program does and why it
    does it that way.
  • All changes are documented with the nature of the
    change, the reason for the change, and the
    initiator of the request.

22
What Makes Good Documentation?
  • Program identification
  • Program name
  • Programmer
  • Date
  • Purpose of program
  • Modular identification
  • Purpose of module
  • Initiator of module
  • Any special or difficult techniques in the module
  • Self-documenting programming.
  • Name controls for what they do.
  • cmdExit.
  • Name variables for what they are.
  • sngNetPay.
  • txtNameEntry.
  • More on this later!

23
Because all of these documentation techniques are
required for the applications that you write,
each technique will be described in detail as we
begin programming.
24
3. Using the T.O.E. Chart
  • Three Easy Steps to Organizing Your Mind
  • Or
  • Bringing Clarity to the Madness

25
Task Object - Event Chart
  • The TOE chart is a required piece of
    documentation for this class.
  • It identifies every technique that the
    application performs and the mode by which it is
    performed.
  • Every event in your program will have a separate
    listing on the TOE chart.

26
Typical TOE Chart
27
4. Consistency in Form and Function
  • Consistency is the best defense against errors.

28
Every Part of the Visual Basic Application Is
Identified
VB will provide default values for everything
that you can identify
For example, if you create three command buttons,
they will be identified on the form and in the
code as Command1, Command2, and Command3
29
Warning
While Visual Basic will allow you to operate
completely using the default values, as the
programs become bigger and more complicated, it
gets harder and harder to figure out what is
going on. Especially for your instructor. For
this reason as well as to follow structured
programming techniques, you are required to write
self documenting code which includes renaming
all identifiable features.
30
  • Many programmers develop personal naming
    conventions that they have developed over the
    years.
  • In this class, we will identify all items using a
    standard three character prefix developed by
    Diane Zak.

More prefixes will be identified as we go!
Forms frmCommand Buttons..cmdText
Boxes.txtPicture Boxes.picLabel
slbl
31
5. Flowcharting
  • Graphically Describing Your Logic FloworRoad
    mapping Your Program

32
Why Flowchart?
  • VB has an interactive editor that catches your
    syntax errors usually before you finish the
    sentence.
  • The majority of programming errors are now
    logic errors.
  • Flowcharting helps you to find your errors before
    you write the code when they are easier to fix.

33
All Logic Has A Flow
  • The flow of logic tends to be deductive
  • If the light is green, then drive through.
  • When the flow is reversed, the results can be
    disastrous.
  • Drive through then check the color of the light.

34
All Logic Has a Flow Part 2
  • It is also possible to flow logic by induction.
  • If the light is not green, then it is probably
    red.
  • If the light is not red then it is probably ok to
    drive through (better).

35
We Use Symbols to Describe the Flow.
Process
Decision
Print
Flow
Connection
Disk Access
36
These Symbols in Combination Help Us to Find
Logic Errors
False
True
Light Red
Drive Through
Stop Wait
37
OK, Lets try one together
We call this
The Mechanical Man
38
Mechanical Man Rules
  • Man starts in chair, arms down.
  • Motions include Stand, Sit, Lift arms,
    Take Step, Turn around.
  • Sensors in finger tips indicate when at wall.
  • Sensors in finger tips cannot sense chair.
  • Chair is unknown, whole step distance from wall.
  • Mission Get Man to the wall and back safely.
  • Complete when Man is safely in chair
Write a Comment
User Comments (0)
About PowerShow.com