Sunteți pe pagina 1din 34

Basic Concepts

of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Before we begin programming, let


us understand some basic concepts
of programming.

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Program
A computer program is an organized list of instructions that, when
executed, causes the computer to behave in a predetermined manner.
Without programs, computers are useless. Therefore, programming
means designing or creating a set of instructions to ask the computer to
carry out certain jobs which normally are very much faster than human
beings can do. (Webopedia)

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Instruction
A basic command. The term instruction is often used to describe the most
rudimentary programming commands. For example, a computer's instruction
set is the list of all the basic commands in the computer's machine language.
(Webopedia)

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Software
Computer instructions or data. Anything that can be stored electronically is
software. (Webopedia)
Software is often divided into two categories:
1. Systems software : Includes the operating system and all the utilities that enable the
computer to function. Other examples of system software are compilers and interpreters.
2. Applications software : Includes programs that do real work for users. For example,
word processors, spreadsheets, and database management systems fall under the
category of applications software.
Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Applications Software
A program or group of
programs designed for end
users.
Systems Software
Refers to the operating system
and all utility programs that
manage computer resources at a
low level.

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Operating System
The most important program that runs on a computer. Every general-purpose
computer must have an operating system to run other programs. Operating systems
perform basic tasks, such as recognizing input from the keyboard, sending output to the
display screen, keeping track of files and directories on the disk, and controlling
peripheral devices such as disk drives and printers.
For large systems, the operating system has even greater responsibilities and powers. It
is like a traffic cop -- it makes sure that different programs and users running at the
same time do not interfere with each other. The operating system is also responsible for
security, ensuring that unauthorized users do not access the system.

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Operating System
Operating systems provide a software platform
on top of which other programs, called
application programs, can run. The application
programs must be written to run on top of a
particular operating system. Your choice of
operating system, therefore, determines to a
great extent the applications you can run. For
PCs, the most popular operating systems are
DOS, OS/2, and Windows, but others are
available, such as Linux.
Programming Concepts

Algorithm

Flowcharting

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Utility Program
A program that performs a very specific task, usually related to
managing system resources. Operating systems contain a
number of utilities for managing disk drives, printers, and other
devices.

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Applications Software
1. Word processor / Word Processing software
A program or computer that enables you to perform word processing functions.
2. Spreadsheet
A table of values arranged in rows and columns. Each value can have a predefined
relationship to the other values. If you change one value, therefore, you may need to
change other values as well. Spreadsheet applications (sometimes referred to simply as
spreadsheets) are computer programs that let you create and manipulate spreadsheets
electronically. In a spreadsheet application, each value sits in a cell. You can define
what type of data is in each cell and how different cells depend on one another. The
relationships between cells are called formulas, and the names of the cells are called
labels.
Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Applications Software
3. Database Management System
A collection of programs that enables you to store, modify, and extract information
from a database. There are many different types of DBMSs, ranging from small
systems that run on personal computers to huge systems that run on mainframes.
The following are examples of database applications:
computerized library systems
automated teller machines
flight reservation systems
computerized parts inventory systems

Programming Concepts

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Programming
Programming means designing or creating a set of instructions to ask the
computer to carry out certain jobs which normally are very much faster
than human beings can do. (Webopedia)
Programming is the iterative process of writing or editing source code.
Editing source code involves testing, analyzing, and refining. A person who
practices this skill is referred to as a computer programmer or software
developer. The sometimes lengthy process of computer programming is
usually referred to as software development.
Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Programming Languages
A programming language acts as a translator between you and the computer.
Rather than learning the computer's native language (known as machine language),
you can use a programming language to instruct the computer in a way that is easier
to learn and understand.

A vocabulary and set of grammatical rules for instructing a computer to perform


specific tasks. The term programming language usually refers to high-level languages,
such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a
unique set of keywords (words that it understands) and a special syntax for organizing
program instructions.
Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

The Language of Computing


As an electronic device, the computer has a unique language that converts the
data we input into a format that the computer can understand . The data we
input into the computer turns into electronic pulses which can either be on or
off or 0 and 1 codes in the binary system. So, the CPU only understands a
combinations of 0 and 1 codes, a language which we called machine
language.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Levels of Programming Languages


There are two levels of programming languages: low-level language and high-level language

1. Low-level languages
is a language that is written at the most basic level of computer operation. As such, it
is more directly understood by the computer. For programmers, however, it is
cumbersome and hard to understand. The two low-level languages are machine
language and assembly language.
Machine Language is a computer language, entirely in binary digits
representing instructions and information, used directly by a computer without
translation.
Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Machine Language
The lowest-level programming language (except for
computers that utilize programmable microcode)
Machine languages are the only languages understood
by computers. While easily understood by computers,
machine languages are almost impossible for humans to
use because they consist entirely of numbers.
Programmers, therefore, use either a high-level
programming language or an assembly language. An
assembly language contains the same instructions as a
machine language, but the instructions and variables
have names instead of being just numbers. (Webopedia)

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Machine Language
Machine language is extremely difficult to learn and it is not for us laymen to master it
easily. Fortunately , we have many smart programmers who wrote interpreters and
compilers that can translate human language-like programs such as BASIC into machine
language so that the computer can carry out the instructions entered by the users.
Machine language is known as the primitive language while Interpreters and
compilers like Visual Basic are called high-level language.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Compiler
A program that translates source code into object code.
The compiler derives its name from the way it works,
looking at the entire piece of source code and collecting
and reorganizing the instructions. Thus, a compiler
differs from an interpreter, which analyzes and executes
each line of source code in succession, without looking at
the entire program. The advantage of interpreters is that
they can execute a program immediately. Compilers
require some time before an executable program
emerges. However, programs produced by compilers run
much faster than the same programs executed by an
interpreter. (Webopedia)

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Interpreter
A command interpreter is the part of a computer operating system that understands
and executes commands that are entered interactively by a human being.
An interpreter translates high-level instructions into an intermediate form, which it
then executes. In contrast, a compiler translates high-level instructions directly into machine
language. Compiled programs generally run faster than interpreted programs. The advantage of an
interpreter, however, is that it does not need to go through the compilation stage during which
machine instructions are generated. This process can be time-consuming if the program is long. The
interpreter, on the other hand, can immediately execute high-level programs. For this reason,
interpreters are sometimes used during the development of a program, when a programmer wants to
add small sections at a time and test them quickly. In addition, interpreters are often used in
education because they allow students to program interactively. (Webopedia)

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Programs written in high-level languages are translated into assembly


language or machine language by a compiler. Assembly language
programs are translated into machine language by a program called an
assembler.
Every CPU has its own unique machine language. Programs must be
rewritten or recompiled, therefore, to run on different types of
computers.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Assembly Language
A programming language that is once removed from a
computer's machine language. Machine languages consist
entirely of numbers and are almost impossible for humans to
read and write. Assembly languages have the same structure and
set of commands as machine languages, but they enable a
programmer to use names instead of numbers. (Webopedia)
Each type of CPU has its own machine language and assembly language, so an assembly language
program written for one type of CPU won't run on another. In the early days of programming, all
programs were written in assembly language. Now, most programs are written in a high-level
language. Programmers still use assembly language when speed is essential or when they need to
perform an operation that isn't possible in a high-level language.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

High-level languages
Even with assembly language, however, programmers saw
that writing programs was still too complicated. Simple
instructions, like finding the sum of 2 numbers, still required
too many steps.
In 1950s, programmers began to develop languages that
could relieve them from the burdensome details of writing
programs in low-level languages. These set-up languages
are called high-level languages. Written in an English-like
manner and using many English words, these languages
offer convenience and simplicity for programmers.
Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

High-level languages
A programming language such as C, FORTRAN, or Pascal that enables a programmer to
write programs that are more or less independent of a particular type of computer. Such
languages are considered high-level because they are closer to human languages and
further from machine languages.
In contrast, assembly languages are considered low-level because they are very close to
machine languages. The main advantage of high-level languages over low-level
languages is that they are easier to read, write, and maintain. Ultimately, programs
written in a high-level language must be translated into machine language by a compiler
or interpreter.
Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Lying between machine languages and high-level languages are languages called assembly languages.
Assembly languages are similar to machine languages, but they are much easier to program in
because they allow a programmer to substitute names for numbers. Machine languages consist of
numbers only.
Lying above high-level languages are languages called fourth-generation languages (usually
abbreviated 4GL). 4GLs are far removed from machine languages and represent the class of computer
languages closest to human languages.

The other four generations of computer languages are :


First generation: machine language
Second generation: assembly language
Third generation: high-level programming languages, such as C, C++, and Java.
Fifth generation: languages used for artificial intelligence and neural networks.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

High-level Programming Languages


Some of the high level computer languages beside Visual Basic are Fortran, Cobol, Java,
C++, Turbo Pascal, and etc.
1. FORTRAN stands for FORmula TRANslator and it was developed by IBM Inc. between 1954 and
1957 which was used specifically for scientific ad engineering applications. It is still widely used today
in the engineering fields.

2. COBOL stands for Common Business Oriented Language which was created by a group of
computer manufacturers and industrial computer users in 1959. It was designed for commercial
applications that required large amount of data processing. It is still being used today in the business
fields.

Programming
Languages

10

11

12

13

14

15

Basic Concepts
of Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

High-level Programming Languages


3. C was developed by Dennis Richie at Bell Laboratories in 1972. It is a system implementation
language that was used to develop the UNIX operating system.

4. C++ is an extension of C which was created by Bjarne Stroustrup in 1980's. It added the OOP
(Object-Oriented Programming) feature to C and now it is the main systems implementation
language (Deitel&Deitel, 1999) .

5. PASCAL was created by Professor Nicklaus Wirth for teaching the concepts of structured
programming. Its use is primarily confined to the academic world.

6. JAVA is the latest but one of the hottest programming languages developed by the Sun
Microsystems in 1995. It was actually an extension of C++ but it has included extensive libraries
for doing multimedia, networking, multithreading , graphics, database access, GUI programming.
Microsoft also come out with its own version of Javawhich is known as Visual J++.

Programming
Languages

10

11

12

13

14

15

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Steps in Programming
The five steps in the programming process are:
1. Define the Problem discuss problem with the users of a system and the systems
analyst to determine the necessary input, processing, and output .
2. Design the Solution design an algorithm and represent the logic using a
Flowcharts or Pseudocode
3. Write the Program express the solution in a programming language

4. Test and Debug the Program translate and debug. Insure that the program works
as planned (Use an Interpreter or Compiler - Run or Execute the Commands which
translate source code into object code)
Steps in Programming

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Steps in Programming
interpreter - translates line by line from source code (actual programming language)
into object code, and identifies syntax errors (violations in using programming language
instructions)
compiler - translates entire program of source code (actual programming language)
into object code, and identifies syntax errors .

5. Document Throughout provide material that supports the design, development, and
testing of the program. Listings of your source code is a type of documentation, so are
comments within the source code as well as user manuals.

Steps in Programming

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

ALGORITHM
An algorithm is a procedure for solving a problem; more specifically, it is a series of
steps that should be followed exactly to produce a desired result.
A computer program can be viewed as an elaborate algorithm. In mathematics and
computer science, an algorithm usually means a small procedure that solves a
recurrent problem

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 ibnMusa al-Khwarizmi, who was part of the royal court in Baghdad and who lived from
about 780 to 850. Al-Khwarizmi's work is the likely source for the word algebra as well.
Algorithm

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

STRUCTURED PROGRAMMING
is a technique that emphasizes the breaking of a program or algorithm into logical sections,
or modules, following a universal programming standard.
is a computer programming in which the statements are organized in a specific manner to minimize
error or misinterpretation.
techniques that impose a logical structure on the writing of a program. Large routines are broken
down into smaller, modular routines.

Structured programming (sometimes known as modular programming) is a subset of


procedural programming that enforces a logical structure on the program being
written to make it more efficient and easier to understand and modify.
Structured Programming

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

CONTROL STRUCTURES
To control the flow of our algorithm
or programs, structured programming
employs what is called

Algorithm

Flowcharting

There are three basic control structures we


must be familiar with: sequence, selection
and iteration.

control

structures - a step, or series


of steps, that determines what
instruction or set of instructions
will be done next.

Control Structures

Basic Concepts of
Programming

Programming
Languages

start

Steps in Programming

Algorithm

Sequence Control Structure


( No Branching)

Process 1

Process 2

Process 3

The sequence control structure is the most


straightforward of all the control structures. In
this case, your algorithm or program will just
follow instructions or statements one after the
other in sequence.

end
Sequence Control Structure

Flowcharting

Basic Concepts of
Programming

Programming
Languages

Steps in Programming

IF
(condition)

Process

(Branching Forwards)
no

Process

start

Flowcharting

Selection Control Structure

start

yes

Algorithm

In a selection structure, a question is asked, and


depending on the answer, the program takes
one of two courses of action, after which the
program moves on to the next event. Also
called decision control structure.

This structure is sometimes referred to as an ifthen-else because it directs the program to


perform in this way: If Condition A is True then
perform Action X else perform Action Y.
Selection Control Structure

Basic Concepts of
Programming

start

Programming
Languages

Steps in Programming

Algorithm

Flowcharting

Iteration / Loop Control Structure


(Branching Backwards)
A single pass through a group of instructions. Most programs contain
loops of instructions that are executed over and over again. The
computer iterates through the loop, which means that it repeatedly
executes the loop

IF
(condition)

yes

Process

no

end

In a loop structure, the program asks a question, and


if the answer requires an action, it is performed and
the original question is asked again until the answer
is such that the action is no longer required.
Each pass through the loop is called an iteration.
Iteration / Loop Control Structure

S-ar putea să vă placă și