0% found this document useful (0 votes)
86 views41 pages

Lesson 1: Chapter 1: Programming Concepts: Marivic B. Mallari

This document provides an overview of programming concepts and the development of computer generations. It discusses the basic components and functions of computers. It also outlines the 5 stages of program development: defining the problem, designing a solution, writing the program, testing and debugging, and documenting. Common programming statements are described like comments, declarations, input/output statements, computations, and comparisons. Flowcharting and pseudocode are presented as ways to design algorithmic solutions. Generations of computers and their characteristics are reviewed from vacuum tubes to modern integrated circuits and networking.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views41 pages

Lesson 1: Chapter 1: Programming Concepts: Marivic B. Mallari

This document provides an overview of programming concepts and the development of computer generations. It discusses the basic components and functions of computers. It also outlines the 5 stages of program development: defining the problem, designing a solution, writing the program, testing and debugging, and documenting. Common programming statements are described like comments, declarations, input/output statements, computations, and comparisons. Flowcharting and pseudocode are presented as ways to design algorithmic solutions. Generations of computers and their characteristics are reviewed from vacuum tubes to modern integrated circuits and networking.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

LESSON 1:

CHAPTER 1: PROGRAMMING CONCEPTS

MARIVIC B. MALLARI
LPT, Instructor
OBJECTIVES:

1. BASIC COMPUTER CONCEPTS


2. DIFFERENT TYPES OF PROGRAMMING
LANGUAGES
3. LEVELS OF PROGRAMMING LANGUAGE
4. PROGRAM PLANNING AND DEVELOPMENT
5. BASIC PROBLEM-SOLVING TECHNIQUES
6. PROGRAM LOGIC FORMULATION USING
PSEUDOCODE AND
FLOWCHARTING
What is a Computer?

A computer is an electronic device that accepts data


from the user, processes it, produces results, displays
them to the users, and stores the results for future
usage.

Data is a collection of unorganized facts & figures and


does not provide any further information regarding
patterns, context, etc. Hence data means
"unstructured facts and figures".
Information is a structured data i.e. organized
meaningful and processed data. To process the data
and convert into information, a computer is used.
Functions of Computers
A computer performs the following functions:

Receiving Input
Data is fed into computer through various input devices like
keyboard, mouse, digital pens, etc. Input can also be fed through
devices like CD-ROM, pen drive, scanner, etc.

Processing the information


Operations on the input data are carried out based on the
instructions provided in the programs.
Storing the information
After processing, the information gets stored in the primary or
secondary storage area.

Producing output
The processed information and other details are communicated
to the outside world through output devices like monitor, printer,
etc.
Generation of Computers
First Generation (1940-1956)
The first generation computers had the following features and components −
Hardware:
The hardware used in the first generation of computers was: Vacuum Tubes and Punch
Cards.
Following are the features of first generation computers −
• It supported machine language.
• It had slow performance
• It occupied large size due to the use of vacuum tubes.
• It had a poor storage capacity.
• It consumed a lot of electricity and generated a lot of heat.
Memory
• The memory was of 4000 bits.
Data Input
• The input was only provided through hard-wired programs in the computer, mostly through
punched cards and paper tapes.
Examples
• The examples of first generation computers are −
• ENIAC
• UNIVACTBM 701
Second Generation (1956-1963)
Several advancements in the first-gen computers led to the
development of second generation computers. Following are
various changes in features and components of second
generation computers :
Hardware
The hardware used in the second generation of computers were:
• Transistors
• Magnetic Tapes
Features
• It had features like
Batch operating system
• Faster and smaller in size
• Reliable and energy efficient than the previous generation
• Less costly than the previous generation
Memory
• The capacity of the memory was 32,000 bits.
Data Input
• The input was provided through punched cards.
Examples
The examples of second generation computers are:
• Honeywell 400
• CDC 1604
• IBM 7030
Third Generation (1964-1971)
Following are the various components and features of the third
generation computers
Hardware
The hardware used in the third generation of computers were:
Integrated Circuits made from semi-conductor materials
Large capacity disks and magnetic tapes
Features
The features of the third generation computers are:
• Supports time-sharing OS
• Faster, smaller, more reliable and cheaper than the
previous generations
• Easy to access
Memory
• The capacity of the memory was 128,000 bits.
Data Input
• The input was provided through keyboards and monitors.
Examples
• The examples of third generation computers are:
• IBM 360/370
• CDC 6600
• PDP 8/11
Fourth Generation (1972-2010)
Fourth generation computers have the following components and features −
Hardware
The Hardware used in the fourth generation of computers were:
ICs with Very Large Scale Integration (VLSI) technology
• Semiconductor memory
• Magnetic tapes and Floppy
Features
It supports features like:
• Multiprocessing & distributed OS
• Object-oriented high level programs supported
• Small & easy to use; hand-held computers have evolved
• No external cooling required & affordable
This generation saw the development of networks and the internet
• It saw the development of new trends in GUIs and mouse
Memory
• The capacity of the memory was 100 million bits.
Data Input
• The input was provided through improved hand held devices, keyboard and
mouse.
Examples
The examples of fourth generation computers are:
• Apple II
• VAX 9000
• CRAY 1 (super computers)
Fifth Generation (2010-Present)
These are the modern and advanced computers. Significant changes in
the components and operations have made fifth generation computers
handy and more reliable than the previous generations.
Hardware
The Hardware used in the fifth generation of computers are:
• Integrated Circuits with VLSI and Nano technology
• Large capacity hard disk with RAID support
• Powerful servers, Internet, Cluster computing
Features
It supports features like:
• Powerful, cheap, reliable and easy to use.
• Portable and faster due to use of parallel processors and
Super Large Scale Integrated Circuits.
• Rapid software development is possible.
Memory
• The capacity of the memory is unlimited.
Data Input
• The input is provided through CDROM, Optical Disk and
other touch and voice sensitive input devices.
Examples
The examples of fifth generation computers are −
• IBM
• Pentium
• PARAM
PROGRAMMING CONCEPTS
Each program has to be well thought out. Instructions must be
ordered in a logical sequence that can easily be understood by the
computer. The problem must be analyzed to such a level of detail that all
logical conditions that may be encountered during the process are taken
into consideration. Otherwise, the wrong results be obtained.

There are 5 stages in developing a program:

(1) defining the problem;


(2) designing a solution;
(3) writing the program;
(4) compiling, debugging and testing the program;
(5) documenting the program.
Stage 1
Defining the problem

The first step in defining a problem begins with recognizing the need for
information. This information may be a request for a solution to a particular
problem. The problem is then thoroughly analyzed in order to determine what
is required of its solution.

To fully analyze the problem, there is a need to define what outputs are
required of the program. The programmer must determine what data are
needed, what form they are to be in, what information is to be outputted,
and how the data are to be manipulated to produce this output.
Stage 2
Designing a Solution
When the definition of the problem is finished, the design of the solution begins. Designing
the solution requires breaking the problem into discrete steps. This sequence of
steps, a strategy for solving the problem is called an algorithm.

Flowcharting
One way a programmer illustrates the sequence of steps in an algorithm is with a flowchart.
A flowchart is a graphical representation of the sequence of operations a
computer is to perform. Flowcharting uses easily recognizable symbols to represent the
type of processing performed in a program.

Pseudocode
A pseudocode is a version of the instructions describing each step the
computer must follow. It is written in an abbreviated form of spoken language and
lies somewhere commands written in ordinary English and those in a computer language.
Stage 3 The programmer uses declarations to define items
used in the program. Examples include definitions of files,
Writing the Program records, initial values, reusable functions and the like.
Input/output statement transfer data to and from
After the programmer has defined the problem and the primary storage for use by the program, as well as to
designed a solution, the next step is to write the program and from other I/O devices like the monitor and the
in a specific programming language. Although the keyboard. Commands such as READ and PRINT are
definition and solution of the problem are independent of examples of these types of statements.
the programming language, the proposed solution to the Computational instructions perform arithmetic
problem may limit the choices of languages that can be operations such as addition, subtraction, multiplication,
used. division and exponentiation. Different programming
Despite the fact that programming languages differ in languages vary in the way they invoke the computer‟s
the commands they use, most high-level programming arithmetic capabilities.
languages have certain types of programming statements Another type of instruction allows the sequence of
in common. These are comments, declarations, execution to be altered by transferring control. A
input/output statements, computations, transfer of control, conditional transfer of control alters the sequence only
and comparison. when a certain condition is met. An unconditional transfer
Comments are statements that have no effect on the of control always changes the sequence of execution.
program. They are simply used to make the program Comparisons allow two items to be compared.
easier to understand. They are inserted at key points in Based on the result of the comparison, input/output,
the program and serve as an internal documentation of computation, or transfer of control could occur.
the program.
Stage 3…Cont.

As the program is being coded, the programmer should be aware that although generating the correct
output is the primary goal of the program, it is not the only requirement of a good program. The programmer
should try to incorporate the following qualities into any program:

 Programs should be easy to read and understand. Data names should be descriptive. Statements
should be placed in a format that is easy to read and follow. Placing enough comments can help in making
the program easier to understand.

 Programs should be efficient. Programs should execute in as little time as possible.

 Programs should be reliable. Programs should consistently produce the correct output. All formulas and
computations, as well as all logic test and transfer control, must be accurate.

 Programs must be robust. Programs should work under all conditions. Reliability alone is no guarantee
of a successful program. Internal logic maybe correct but an incorrect data item could produce an incorrect
output. For example, how a program would react if a person‟s age were 2, 045 or -54?

 Programs should be maintainable. They should be easy to update and modify. Programs should be
written in independent modules so that a change in one module does not necessitate a change in others.
Stage 4

Compiling, Debugging and Testing the Program

Instructions must be translated into machine language before they can


be executed. A compiler is a special program for each programming
language that is loaded into the computer when that language is used.
It translates each line of code into the machine instruction that can be
understood by the computer.
Stage 5
Documentation of the Program

Documentation consists of written descriptions and explanations of programs and other materials associated with
an organization’s data processing system. Documentation of a system and a program designs is one of the most
important requirements for success in data processing application. Proper program documentation serves as a
guide for programmers and analysts who must modify or update existing programs and system procedures.
The process of documentation is an ongoing one. It begins with the initial request for information. The individual
making the request should be identified. So should those responsible for designing the system and required
programs.
During the problem definition stage, the problem should be described clearly in a short narrative statement. The
objectives of the program should be included with the problem statement. Several other descriptions are needed.
 A complete description of the contents and formats of all data inputs, outputs and files to be used.
 A statement of the hardware requirements for running the program, as well as estimated processing time and
storage requirements.
 A statement of software requirements, such as utility programs and library programs.

In the planning phase, the most important documentation produced is the flowchart. Descriptive
comments maybe included for each processing step. The test data used to test the program should also
be included.
Programming Language

A language is defined as a system for communicating. Written language uses


symbols (that is, the characters) to build words. The entire set of words is the
language vocabulary. The language syntax and grammar define the way in
which the words can be meaningfully combined. The actual meaning of words
is defined by the language semantics.
In computer science, human languages are known as natural languages.
Unfortunately computers are not sophisticated enough to understand natural
languages. So in order for humans to communicate with computers, we must
communicate using special computer language.
Machine Language
- It is the only language that the computer understands.
- It consists only of numbers. Each different type of CPU has its own unique machine
language. A programming language, on the other hand defines a vocabulary and a set of
grammatical rules for instructing a computer to perform specific tasks. Each language has a
unique set of keywords and a special syntax for organizing program instructions.

Programming Languages can be broadly classified as either high level programming


languages or low-level programming languages. High level programming languages are
more complex than the language the computer actually understands. But they are simple
compared to human languages.
Machine language is the lowest level programming language. It is the only language
understood by, computers and consists of pure numbers. Machine language functions as the
target language of other language programs. The other language programs must be translated
into machine language before the computer can execute the instructions. Because the data in
digital computers is stored as either on or off electrical states, machine language takes the
form of either 1 or 0.
Low-level language
Low level languages are also called Assembly language and are similar to
machine language. But in contrast, assembly language is much easier to
understand than a machine language. Assembly languages were developed to
overcome the disadvantage of machine language. Instead of using 1‟s and 0‟s, to
specify machine instructions, programmers use mnemonics or machine op codes.
The mnemonics are English-like abbreviations for the machine language
instructions.

Programmers who write low-level language programs must be highly skilled in two
areas. First, they must know a great deal about the internal workings of the
microprocessor, and a broad technical knowledge of the computer is needed.
Secondly, the programmer must be detailed oriented, every step of the computer
must be coded and the actual numerical address of the instructions and data must
be specified.
High-level Programming language
High-level programming languages enable the 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 language than the
machine language the computer truly understands. The main advantage of a
high level language over low level language is that they are easier to understand.
They allow the programmers to focus on solving the problem rather than knowing
how to program the computer.
Ultimately, programs written in a high level language must be translated into
machine language. Examples of High level languages are C, FORTRAN and
Pascal. Since their development in the 1950‟s, many other languages have been
developed today. These include Ada, Algol, BASIC, COBOL, C++, LISP and
Prolog.
EXAMPLES OF HIGH-LEVEL LANGUAGE
1. BASIC

BASIC is an acronym for Beginner’s All-Purpose Symbolic Instruction


Code. It was developed by John Kemeny and Thomase Kurtz in the early
1960‟s. Their goal was to create a language that would be easy to learn and
that would help students to understand programming. BASIC is a simplified
version of the first high-level language that was FORTRAN.
It was generally implemented as an interpretive language, which is the
reason why it became the popular language for education. The student can
learn in an interactive way, because of the immediate response for the
correctness of the program syntax.
2. FORTRAN

FORTRAN is short for Formula Translator, and it is the oldest high-level


programming language. It was developed in the mid-1960‟s by John Backus when
most programs were written in either machine language or assembly language. At that
time, IBM supported the idea that programming language be developed that resembles
the English language and can be translated into machine language.
It was primarily intended as a high-level language used for programming
scientific, mathematical and engineering applications. The two most common
versions of FORTRAN are FORTRAN IV and FORTRAN 77. FORTRAN 77 was
approved by ANSI in 1978 and it contains features that are not available in the older
version. Developed in the early 1990‟s FORTRAN-90 (to be followed by FORTRAN-95)
is the latest version of the FORTRAN language.
3. COBOL
COBOL is short for Common Business-Oriented Language and is the most
frequently used business programming language. It is used extensively in
business, education and government. COBOL stated in the early 1960‟s 7

when a committee led by the U.S. Department of Defense and other computer
users and manufacturers, known as CODASYL ( Conference of Data Systems
Language) wanted to develop a common business programming language. They
were the ones who established the specifications for the COBOL language. Dr.
Grace Murray Hopper was a major contributor to the structure and development
of the COBOL language. By mid 1960‟s the first commercial version of the
COBOL language was offered. In 1968 ANSI published guidelines for
standardized COBOL that became known as ANSI COBOL.
4. Pascal
Pascal was the language named after the seventeenth century French
mathematician Blaise Pascal who constructed one of the first adding machines. It
is a high-level language developed by Nicklaus Wirth of Zurich Switzerland in the
late 1960‟s. Pascal is one of the first languages developed using a structured
programming approach. Pascal reflects a top-down modular programming
design. It forces the programmers to design programs methodically and carefully.
It is for this reason that Pascal became a popular teaching language. Pascal
language is a balance between a wordy language like COBOL and terse language
like FORTRAN. Originally intended for teaching purposes, Pascal rapidly
expanded and was used in business and scientific applications.
An example of a PASCAL program that will multiply two numbers, 243 and 87 and
printing the result is shown.
An example of a PASCAL program that will multiply two
numbers, 243 and 87 and printing the result is shown.
5. C Language
C is a high-level programming language developed by Dennies Ritchie at the
Bell Laboratories in 1972. The language was named C, because it was influenced
by another language called B developed by Ken Thompson. It was originally
designed as a systems programming language, which means that it was used to
write operating system programs. The UNIX operating system and its utilities
were written in over 300,000 lines of C code.

C is a popular language for writing system programs and applications software for
several reasons. C produces codes that run very fast compared to the other
languages, almost at the same speed as assembly language. This is also the
reason why the C language is referred to as a middle-level language. It provides
the speed of assembly language with high-level programming capabilities. C
programs are also highly portable; they are independent of the machine, so C
codes can run on many different computers. It can be implemented on small
8-bit computers. The language is also compact, which requires only a small
memory to run.
6. C++ Language

During the late 1980‟s until the early 1990‟s object-oriented programming started
to become popular. This led to the development of object-oriented languages:
Object-Pascal, Modula-2, Mesa, Cedar, Neon, Objective-C, LISP and C++. C+
+ was developed by Bjarned Stroustrup while working at the Bell Laboratories.
C++ is actually an extension of C, and while it is not entirely a new language,
significant extensions to the C language have been adopted. C++ is considered a
superset of C, and it has the same capabilities as C with added object-
oriented features. C++ is a powerful language, but the language still has the
flexibility and efficiency of C with added support for creating object classes.
Although C++, was originally designed to aid in the management of very large
programs, its applications are not limited to this. The object-oriented capabilities of
C++ can be applied to virtually any programming task. C++ is one of the most
powerful and efficient programming languages today.
7. Java

The Java programming language is the popular programming for creating


applications on the Web. These applications are called “applets” because they
are small application programs. Before the development of Java web pages were
viewed as static documents on the Web browser. These “static” web pages were
creating using HTML (Hypertext Markup Language) and most companies
organize web pages using CGI (Common Gateway Interface).
Java, whose original name was Oak, was developed by in December 1990 by Sun
Microsystems. Java was created as a programming tool, part of the Green
project of Sun whose task was to create something new and exciting. The original
team members of the Green project (also known as the secret “Green Team”) were
Patrick Naughton, Bill Joyo and James Gosling. And were later joined by Chris
Warth, Ed Frank and Craig Forrest.
Interpreters and Compilers

Regardless of what type of language you use, eventually you will convert
your programs into a machine language so that the computer can
understand it. When we write our programs in a high-level language the
computer cannot understand the language because it only operates in bit.

There is a need for a translation process that will convert the programs written
in high-level language into machine language. There are two ways of doing
this either compile the program or interpret the program. Compiling and
interpreting a program can be accomplished by using other programs called
compilers and interpreters, these programs translate the program we have
written into a machine language.
Compiler

A compiler is a program that translates a program written in a high-level


language (source code) and translates it into machine language (object
code). The compiler derives its name from the way it works. It analyzes
the entire piece of source code and then re-organizes the instructions and
then translates it into machine code.

Every high-level programming language (except strictly interpretive


languages) comes with a compiler. In effect, the compiler is the
language, because it defines which instructions are acceptable and which
are not.
Interpreter

The most common way to translate a high-level language to machine


language is to compile the program; other method is to pass the
program through an interpreter. The interpreter translates and
executes the program line by line. An interpreter translates into an
intermediate form, which it then executes. In contrast, a compiler
translates high-level instructions directly into machine language.

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 compilation process can be time-consuming if the
program is long. The interpreter, on the other hand, can immediately
execute high-level programs.

You might also like