CHAPTER 1 OVERVIEW OF BASIC PROGRAMMING

You might also like

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

CC02 MODULE FUNDAMENTALS OF PROGRAMMING

CHAPTER 1: OVERVIEW OF BASIC PROGRAMMING

Objectives:
a.) Describe what is programming.
b.) Recognized the importance of programming process
c.) Compare and contrast in executing source code into a
program.

Nowadays computers are able to perform many different tasks, from simple mathematical
operations to sophisticated animated simulations. But the computer does not create these tasks
by itself, these are performed following a series of predefined instructions that conform what we
call a program.
A computer does not have enough creativity to make tasks which it has not been
programmed for, so it can only follow the instructions of programs which it has been programmed
to run. Those in charge of generating programs so that the computers may perform new tasks are
known as programmers or coders, who for that purpose use a programming language.
WHAT IS PROGRAM?

The word program is used in two ways:

1. to describe individual instructions, or source code, created by the programmer, and to


2. describe an entire piece of executable software.

Source code can be turned into an executable program in two ways:

1. Interpreters translate the source code into computer instructions,


and the computer acts on those instructions immediately. Alternatively,
2. Compilers translate source code into a program, which you can run
at a later time. While interpreters are easier to work with, most serious programming
is done with compilers because compiled code runs much faster. C++ is a compiled
language.

Page 1
CC02 MODULE FUNDAMENTALS OF PROGRAMMING

DIAGRAM 1. Compiler vs Interpreter

Compiler characteristics:
• Spends a lot of time analyzing and processing the program
• The resulting executable is some form of machine- specific binary code
• The computer hardware interprets (executes) the resulting code
• Program execution is fast
Interpreter characteristics:
• Relatively little time is spent analyzing and processing the program
• The resulting code is some sort of intermediate code
• The resulting code is interpreted by another program
• Program execution is relatively slow

PROGRAMMING PROCESS

All programming involves creating something that solves a problem. The problems can
range from something of great scientific or national importance, through to something as trivial as
relieving personal boredom!

Page 2
CC02 MODULE FUNDAMENTALS OF PROGRAMMING

This section describes one approach to solving such problems - think of it as a rough guide
to the things you should do when entering the land of programming.

The programming process consists of 5 steps. These are really only guidelines that have
come to be recognized as being part of writing good, easily understood, and useful computer
programs.

1] Define the Problem

The programmer prepares a problem statement outlining the answers to the following
questions:
1. What is the job to be done?
2. What is the input data to be processed?
3. How is the data to be processed?
4. What is the desired format of the output?

2] Analyze the Problem

A plan of action is prepared describing the processing sequence of the operations. The
plan may be in the form of a
1. Decision table – presents a complex situation, the conditions and the corresponding
actions.
2. Flowchart – shows the sequence of operations.

3] Code the Program

The sequence of operations contained in the flowchart is translated into a set of


instructions written in symbolic languages like COBOL, BASIC, C, C++, etc. This program is then
loaded into the memory of a computer where a compiler program translates this set of instructions
into machine readable form.

4] Debug and Test the Program

Programs are tested to locate and correct programming errors or bugs. programming errors are
due to:

1. Clerical error – Ex. Assigning the same statement number to two instructions
2. Logical error – ex. Omitting certain facts important to the whole system in a payroll
application.

Types of Errors
30
1. Compile-time error or syntax errors

➢ occur if there is a syntax error in the code.


➢ The compiler will detect the error and the program won't even
compile. At this point, the programmer is unable to form an
executable program that a user can run until the error is fixed.

Page 3
CC02 MODULE FUNDAMENTALS OF PROGRAMMING

2. Runtime Errors
➢ Compilers aren't perfect and so can't catch all errors at compile time.
➢ This is especially true for logic errors such as infinite loops. This type of error is
called runtime error

Debugging is done using these methods:

a. Desk checking – manual review of the program


b. Diagnostics – computer prints out error messages through the computer
programs.

5] Document the Program

All data pertaining to a program are collected, organized, and recorded. A complete
documentation gives the following advantages:

1. Simplifies program revision


2. Enables another programmer to modify or maintain the program.
3. Facilitates the operation of the program by the operator.
4. Minimizes need for major program overhaul.

DEFINITION OF TERMS

Coding - is the act of translating the design into an actual program, written in some form
of programming language. This is the step where you actually have to sit down at the
computer and type!

Programming- is then the task of describing your design to the computer: teaching it your
way of solving the problem

Compilation- is actually the process of turning the program written in some programming
language into the instructions made up of 0's and 1's that the computer can actually follow.

Debugging- is simply the task of looking at the original program, identifying the
mistakes, correcting the code and recompiling it.

Code - The instructions in a computer program. Instructions written by a programmer in a


programming language are often called source code. Instructions that have been
converted into machine language that the computer understands are called machine
code or executable code.

Page 4
CC02 MODULE FUNDAMENTALS OF PROGRAMMING

For more knowledge Software Engineering, please check the link


provided;

➢ https://www.youtube.com/watch?v=quW5dAGpXiU
➢ https://www.youtube.com/watch?v=e4ax90XmUBc
➢ https://www.youtube.com/watch?v=AImF__7FyzM

REFERENCES

❖ https://dev.to/lucpattyn/basic-programming-concepts-for-
beginners-2o73
❖ https://codewithchris.com/learn-programming/
❖ https://docs.microsoft.com/en-us/dotnet/csharp/programming-
guide/concepts/

Page 5

You might also like