0% found this document useful (0 votes)
29 views

Introduction To Programming: Code All at A Time

This document provides an introduction to computer programming and the programming process. It discusses: - What computer programming involves, including writing instructions for computers to complete tasks. - The main components of a computer program, including algorithms, programming languages, and translating source code into machine-readable object code. - The programming process, which involves problem definition, program design, coding, testing, and debugging. - Key aspects of writing programs, such as readability, maintainability, efficiency, and reliability. Flowcharts are used to illustrate program logic and control structures.

Uploaded by

Jeric Sobremonte
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Introduction To Programming: Code All at A Time

This document provides an introduction to computer programming and the programming process. It discusses: - What computer programming involves, including writing instructions for computers to complete tasks. - The main components of a computer program, including algorithms, programming languages, and translating source code into machine-readable object code. - The programming process, which involves problem definition, program design, coding, testing, and debugging. - Key aspects of writing programs, such as readability, maintainability, efficiency, and reliability. Flowcharts are used to illustrate program logic and control structures.

Uploaded by

Jeric Sobremonte
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Ch E 524

Introduction to Programming

COMPUTER PROGRAMMING
• involves writing instructions and giving them to the computer to complete a task.
• involves tasks such as; analysis, generating algorithms, profiling algorithms' accuracy and
resource consumption, and the implementation of algorithms in a chosen programming
language
COMPUTER PROGRAM
• a set of instructions written in a computer language, in order to be executed to perform a
specific task.
• Computer Programs are also named as SOFTWARE.

TYPES OF AVAILABLE SOFTWARE


• Operating System Software
• Compilers and Interpreters
• Application Software
• Embedded System Software
• Utilities and Tools for productivity

PROGRAMMER
• a person who writes the required computer programs.
• translate the expected tasks given in human understandable form into machine understandable
form by using compilers and interpreters.
COMPILER- a specific software that gets the whole Source Code and translates it into Object
Code all at a time.
INTERPRETER- translating and executing one statement of Source Code into Object Code at a
time.
SOURCE CODE- Computer program written in human understandable form
OBJECT CODE- Computer Program that is in machine understandable form
STATEMENT- command of Computer Program

CHARACTERISTICS OF A PROGRAM
Well designed programs must be:
• Correct and accurate
• Easy to understand
• Easy to maintain and update
• Efficient
• Reliable
• flexible

PROGRAMMING PROCESS
1. Problem definition
• What must the program do?
• What outputs are required and in what form?
• What inputs are available and in what form?
2. Program Design involves creating an algorithm – sequence of steps, by which a computer can
produce the required outputs from the available inputs
Ch E 524
Introduction to Programming

Top-down design
• The main problem is split into subtasks
• Then each subtask is divided into simpler subtasks, etc. unless it is clear how to solve all
such subtasks
3. Program Coding means expressing the algorithm developed for solving a problem, in a
programming language
Program Compilation – translation of a program written in a high-level programming
language into machine language instructions
Compilation step converts a source program into an intermediate form, called object
code
Linking step is necessary to combine this object code with other code to produce an
executable program
The advantage of this two-step approach:
• Source of the large program may be split into more than one file
• These files are worked on and compiled separately
• Object code may be stored in libraries and used for many programs
• Then they will be combined into one executable code

4. Program Testing & Debugging


Initially, almost all programs may contain a few errors, or bugs
Testing is necessary to find out if the program produces a correct result. Usually it is
performed with sample data
Debugging is the process of locating and removing errors

TYPES OF ERRORS
• Syntax Errors: a character or string incorrectly placed in a command or instruction that
causes a failure in execution. Violation of syntactic rules in a Programming Language generates
syntax errors.
• Semantic Errors: it requires you to work backward by looking at the output of the program
and trying to figure out what it is doing. Doing logical mistakes causes semantic errors in Source
code.
• Run-time Errors: Occur on program execution. Mostly caused by invalid data entry or tries to
use not existing resources.

PROGRAMMING
Programming task can be separated into 2 phases
1. problem solving phase
• produce an ordered sequence of steps that describe solution of problem
• this sequence of steps is called an algorithm
STEPS IN PROBLEM SOLVING
• First produce a general algorithm (one can use pseudocode)
Pseudocode is an artificial and informal language that helps programmers develop algorithms.
Pseudocode is very similar to everyday English. It is a simpler version of a programming code in
plain English which uses short phrases to write code for a program before it is implemented in a
specific programming language.
Ch E 524
Introduction to Programming

• Refine the algorithm successively to get step by step detailed algorithm that is very
close to a computer language.
Algorithm is a systematic logical approach which is a well-defined, step-by-step procedure that
allows a computer to solve a problem

2. implementation phase
• implement the program in some programming language (Pascal, Basic, C, C++,
Java….etc)

THE FLOWCHART
• (Dictionary) A schematic representation of a sequence of operations, as in a manufacturing
process or computer program.
• (Technical) A graphical representation of the sequence of operations in an information system
or program. Information system flowcharts show how data flows from source documents
through the computer to final distribution to users. Program flowcharts show the sequence of
instructions in a single program or subroutine. Different symbols are used to draw each type of
flowchart.
• shows logic of an algorithm
• emphasizes individual steps and their interconnections
• e.g. control flow from one action to the next
Logical system
a) Consistency
b) Validity
c) Completeness
d) Soundness

FLOWCHART SYMBOLS
Name Symbol Use in Flowchart

Oval Denotes the beginning or end of the program

Parallelogram Denotes an input operation

Rectangle Denotes a process to be carried out


e.g. addition, subtraction, division etc.

Diamond Denotes a decision (or branch) to be made.


The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)

Hybrid Denotes an output operation

Flow line Denotes the direction of logic flow in the program


Ch E 524
Introduction to Programming

LOGICAL CONTROL STRUCTURES


• The order in which process steps are done can be broken down into three fundamental
control patterns:
 Sequence
With a sequential Pattern, one step is completed.
Then a next step is completed and so on.

 Selection

With a selection pattern, the answer to a decision


causes a branch in the process. Thus, some steps are
skipped under certain circumstances

 Repetition
The repetition ( also known as loop )
control structure, allows one or more actions to
be repeated.

GUIDELINES FOR FLOWCHARTING

You might also like