Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lesson Proper

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

LESSON PROPER

Computers are not intelligent. Yes, computers are fast. They are able to calculate complex computations
in mere seconds. However, being fast does not make computers intelligent. It only makes them highspeed
followers, nothing more. In reality, computers are only as good as instructions or programs you feed them.
This is a very important point to consider in programming.

Programming is the art and science of creating programs. A program is a list of organized instructions
that the computer must follow in order to process data into information.

Program Development Process

You might think that programming simply involves typing words and numbers in a computer. Actually,
this activity, called coding, is only a small part of the whole programming process. Programming, also called
software engineering, is a multi-step process for creating a program.

Programming is also a method of solving a problem. Programming uses algorithms an algorithm being a set
of ordered steps for solving a problem, and essentially a synonym of logic. Analytical and critical thinking is
needed in the formulation of solutions to a problem.

Steps in program development

You solve problems most of the time. One simple problem is deciding whether to do your assignment
before or after playing games. A more complicated one is computing the average of your 6 quizzes in math.
A rather complex one is preparing your school’s payroll processing system.

How, Then, do we approach the activity of programming? The following are the procedural steps required
in the problem-solving process called programming:
1. Problem Analysis
2. Program Design
3. Program Coding
4. Program Testing and Debugging
5. Program Documentation and Maintenance

The First Step: Problem Analysis

Problem analysis is defined by the American National Standards Institute (ANSI) as the methodical
investigations of a problem and the separation of the problems into smaller related units for further detailed
study.

Problem analysis requires performing the following steps:

1. Define the problem and the users. Here, you need to write a statement on the objectives of the
program you are trying to accomplish (that is, the problem you are trying to solve). If it is large
program with many functions, divide it into its component parts or modules and state the
purpose for each module. You also need to know who will be the users of the program, as well
as their skills in using the program.
2. Determine the desired outputs. Understand first the kind of outputs expected of your program
(that is, the information to be produced and its format) before you study the inputs.
3. Determine the desired inputs. Once you know the kind of outputs required, you can then think
about the inputs. Determine the kind of data needed to produce the output, the format on how
the data should appear, and the sources of data.
4. Determine the desired processing. Describe what operations are necessary to transform the
inputs into the desired results. Diagrams are often helpful to clearly define the
transformations involved.
5. Double-check the feasibility of implementing the program. Clarify if the program you are
supposed to create is feasible within the present setup and/or budget. You may probably
decide to buy an existing program and modify it rather than write one from scratch.
6. Document the analysis. Make sure you document everything you do, such as writing the
objective specifications of the entire process of problem analysis
The Second Step: Program Design

The program design process describes the algorithm for the solution of the problem. Algorithms specify
what actions and operations a program will take. A programmer has several program design tools to choose
from—flowcharts, decision tables, or pseudocodes in formulating an algorithm

Program design requires performing the following steps:

1. Determine the program logic using a top-down approach and modularization

Logically, laying out a program is like outlining a lengthy term paper before you proceed to writing it.
Currently, object-oriented programming is the approach used by many programmers. This style
produces programs with clean flow, clear design, and a degree of modularity or hierarchical structure.

Structured programming takes a top-down approach that breaks down a large program into smaller
pieces or modular forms, called modules, and assembles these pieces into a program with coherent
logic flow. The concept of modularization is useful as the entire program can be more easily developed
because the parts (the modules) can be develop and tested separately.

2. Design details using pseudo code and/or flowcharts.

When you have already determined the essential logic of your program through the use of top-down
programming and hierarchy chart, you can then go to work to the details.

There are two ways to show details—write them by using pseudocode or draw them by using
flowcharts. Most projects use both methods.

Pseudocode: A pseudocode (pseudo means fake) is an algorithm written in normal human-language


statements to describe the logic and processing flow. Many programmers write their programs first in
pseudocode that looks much like a mixture of English and their favorite programming language, such
as C, and then translate it line by line into the actual language being used.

A pseudocode can also contain such terms as IF, THEN, or ELSE. It has to, however, follow the rules of
control structures, an important aspect of structured programming.

How do you write a pseudocode? Study the example below.

Problem:

Get the following data from the user: employee’s name, hourly rate, number of hours worked, and deductions

Calculate the employee’s gross pay and net pay

Display the employee’s name, gross pay, and net pay

Pseudocode:

READ name, hourly rate, hours worked, deductions

Calculate: Gross pay = hourly rate multiplied by number of hours worked


Calculate: Net pay = Gross

● - “Flowcharts use special shapes to represent different types of actions or steps in a process.
Lines and arrows show the sequence of the steps, and the relationships among them”.
● - “Use of symbols and phrases to designate the logic of how a problem is solved” (SCHN95).
● - “A diagram representing the logical sequence in which a combination of steps or operations is
to be performed. It is a blueprint of the program”(LAPU86).
● - A system flowchart is a diagrammatic representation of the broad flows of work, documents
and operations. A system flowchart shows what job is to be done. Thus, a system flowchart
merely names the processes to be performed in the “predefined process”.
● - A program flowchart is a diagrammatic representation of a solution to a given problem for
which the program is written. A program flowchart shows how the job is to be done. Thus, a
program flowchart outlines the details of the sequence of operations to be executed.

Algorithm Defined

- Algorithm is a finite set of instructions that specify a sequence of operations to be carried out in order to
solve a specific problem or class of problems” (SWAZ89).

- An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem. The word
derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi, who was part of the royal
court in Baghdad and who lived from about 780 to 8'

1.2 Basic symbols used in Flowcharting


3. Do a structured walkthrough.

Have you experienced, after thoroughly reviewing and editing your term paper, having a friend or teacher
point out some things you missed? The same experienced happens to programmers.

There is an established part of the design phase called structured walkthrough. It is a method for
examining a computer system, including its design and implementation, in a systematic way. In the
structured walkthrough, the programmers (as well as fellow programmers, systems analysts and perhaps,
users) working on different aspects of a software development project meet and attempt to coordinate the
various segments of the overall project. The goals, requirements, and components of the project are
systematically reviewed in order to minimize the error rate of the software under development.

Flowchart and Algorithm examples

1. Design a flowchart that will accept and display a number. Write its equivalent algorithm
The Third Step: Program Coding

Once the program design has been developed and reviewed in a structured walkthrough, the actual writing
of the program begins. This process is called coding. In coding, the logic requirements from pseudocode,
algorithm or flowcharts are translated into lines of instructions using a programming language—the letters,
numbers and symbols arranged accordingly to syntax or language rules that make up the program. The
purpose of this step is basically to prepare the program to be inputted to the computer system.

Here are the steps in coding the program:

1. Select the appropriate programming language

A programming language—such as C, Visual Basic and Java—is a language used to write instructions for
the computer.

Not all languages are appropriate for all uses. While some have strengths in mathematical and statistical
processing, others are more appropriate for database management. Hence, in selecting a programming
language, you can base it on considerations as:

● What purpose the program is designed to serve, and


● What languages are already being used in the organization or field you are in.

2. Follow the syntax.

Just as in human languages (Filipino, English, Spanish, etc.), programming languages have their own
grammar—the system of rules for the languages by which words are formed and put together to make
sentences.

Syntax is the grammar of a language. It consists of the rules governing the structure and content of the
statements. For a computer Program to work, you have to follow strictly and perfectly the syntax of its
language.
The Fourth Step: Program Testing and Debugging

Program testing involves running various tests, such as desk-checking and debugging (These two test
are called alpha testing.), and then running actual or real data to make sure the program works (This is called
beta testing.). The following are the steps in testing a program:

1. Perform desk Checking

Desk checking is simply reading through, or manually testing, the solution to make sure that it is free of
errors and that the logic works. Desk checking is like proofreading. You should do desk-checking before
running your program.

2. Debug the program

After desk-checking, the programmer needs to compile the source code to convert it into an object code.
This is necessary because computers cannot understand a programming language directly unless it is
transformed into a machine language. A source code refers to the instructions in a programming language
while object code refers to the instructions in a machine language, which is a language of computers. The
process of converting a source code into object code is called compilation.

During compilation, some program errors (called bugs) may be encountered, causing the program’s
failure to produce the desired output. The programmer needs to go through the process of detecting,
locating, and removing these errors (also called debugging) in order for the program to be able to solve the
problem at hand. There are three types of program errors: syntax error, run-time error, and logic error.

Syntax error is the most common error that you will encounter in programming. It is caused by
typographical errors (such as misspelled words or incorrect symbols) and/or failure to strictly follow the
syntax of the programming language (such as omitted punctuation or unmatched parenthesis).

Run-time error is a software error that occurs while a program is being executed, as detected by a
compiler or other supervisory programs. Mostly, run-time errors occur in numeric calculations, such as
dividing a number by zero (resulting to “divide error”); in evaluating an expression that would result in an
illegal data, such as assigning to an integer type variable a value greater than 32 767 (which results to an
“overflow”); or in giving an improper input, such as when a user entered a character data where an integer
vale is expected.

Logic errors are caused by incorrect use of control structures. These errors are much more difficult to
detect than syntax errors because the computer cannot tell an error in logic in a program.

3. Run real data

After desk-checking and debugging, the program, then needs to be tested with real data, called
beta-testing. There is a need to also test a program with bad data—data that is faulty, incomplete, or in
overwhelming quantities—to see if this can make the system crash. In programming, programmers should
consider the fact that there could be users who are far more heavy-handed, ignorant, and careless.

The Fifth Step: Program Documentation and Maintenance

Documentation is the set of instructions shipped with a program or a piece of hardware. Documentation
usually includes necessary instructions on the use and maintenance of the product. It is not just an
end-stage process of programming. In fact, it needs to be done throughout the entire programming steps. It
is needed for people—users, computer operators, and programmers—who will be using the program or who
will be involved with the program in the future. Program documentation and maintenance consists of the
following steps:

1. Prepare user documentation. The printed, on disk, or online manuals in commercial software
packages are user documentation which can help nonprogrammers use the software.
2. Prepare operator documentation. The people who run computers are called computer
operators. They are not necessarily programmers; hence, they also need information (the
documentation) on what to do when the program malfunctions.
3. Prepare program documentation. Program documentation consists of written, graphic, and
electronic Descriptions of what a program is and how to use it. This makes the program
understandable even at a later time. The variables are defined and the comments are made to
be informative. New programmers can maintain an existing system because of program
documentation. Good documentation reduces effort on program maintenance and major
program overhaul.
4. Maintain the program. Maintenance is any activity designed to keep programs error-free,
up-to-date, and in good working condition. It includes tests, adjustments, replacements,
repairs, and so on. Since organizations change their products, marketing strategies,
accounting systems, etc., these changes should be documented to help programmers make
adjustments in existing systems.

You might also like