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

Lec 5

This document provides an overview of a lecture on programming languages and the programming process. It discusses the six steps of programming: program specification, design, coding, testing, documentation, and maintenance. It also outlines the five generations of programming languages: machine languages, assembly languages, procedural languages, task-oriented languages, and problem and constraint languages. The first generation is machine languages, which use binary 1s and 0s. The second generation is assembly languages, which use abbreviations that translate to machine code.

Uploaded by

smnepalschool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Lec 5

This document provides an overview of a lecture on programming languages and the programming process. It discusses the six steps of programming: program specification, design, coding, testing, documentation, and maintenance. It also outlines the five generations of programming languages: machine languages, assembly languages, procedural languages, task-oriented languages, and problem and constraint languages. The first generation is machine languages, which use binary 1s and 0s. The second generation is assembly languages, which use abbreviations that translate to machine code.

Uploaded by

smnepalschool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Lecture 5 Computer Principles

University of Technology
Computer Engineering Department
Computer Principles

Asst.Lect. Zinah Jaafer Mohammed Ameen

Lecture 5
Programming Language

Lecture Layout:

• Programs and programming


• Generations of programming languages

1
Lecture 5 Computer Principles

 Programs and Programming

A program is a list of instructions for the computer to follow and


accomplish the task of processing data into information. The instructions are
made up of statements used in a programming language, such as BASIC, C,
or Java. Programming, also known as software development, is a six-step
procedure for creating that list of instructions. Only one of those steps
consists of typing (keying) statements into a computer. The six steps are as
follows:

1. Program specification: The program’s objectives, outputs, inputs, and


processing requirements are determined.
2. Program design: A solution is created using programming techniques
such as top-down program design, pseudo code, flowcharts, and logic
structures.
3. Program code: The program is written or coded using a programming
language.
4. Program test: The program is tested or debugged by looking for syntax
and logic errors.
5. Program documentation: Documentation is an ongoing process
throughout the programming process. This phase focuses on formalizing the
written description and processes used in the program.
6. Program maintenance: Completed programs are periodically reviewed
to evaluate their accuracy, efficiency, standardization, and ease of use.
Changes are made to the program’s code as needed.

2
Lecture 5 Computer Principles

In organizations, computer professionals known as software engineers or


programmers use this six-step procedure. Working closely with systems
analysts in systems development, Phase 4 of the systems life cycle,
programmers create software required for information systems.
Step 1: Program Specification
Program specification is also called program definition or program
analysis. It requires that the programmer—or the end user specify five
items: (1) the program’s objectives, (2) the desired output, (3) the input data
required, (4) the processing requirements, and (5) the documentation.

3
Lecture 5 Computer Principles

Step 2: Program Design


After program specification, a program design phase is started. Here the
programmer plans a solution, preferably using structured programming
techniques. These techniques consist of flowcharts and logic structures.
Flowcharts
These graphically present the detailed sequence of steps needed to solve a
programming problem. This figure presents several of the standard
flowcharting symbols. Flowchart expresses all the logic for just one module
A computer does more than arithmetic. It also makes comparisons whether
something is greater than or less than, equal to or not equal to.

4
Lecture 5 Computer Principles

Step 3: Program Code


Writing the program is called coding. Here the software developer uses the
logic he developed in the program design step to actually write the program.
That is, he writes out using pencil and paper or typing on a computer
keyboard the letters, numbers, and symbols that make up the program. This
is the “program code” that instructs the computer what to do.
The Good Program should be reliable work under most conditions and
produce correct output. It should catch obvious and common input errors. It
also should be well documented and understandable by programmers other
than the person who wrote it. After all, someone may need to make changes
in the program in the future.
Coding: After the program logic has been formulated, the next step is to
code or write the program using the appropriate computer language. There
are numerous content-markup and programming languages. A content-
markup language uses symbols, words, and phrases that instruct a
computer how to structure information for display or processing. For
example, HTML is a widely used content-markup language to create Web
pages.

5
Lecture 5 Computer Principles

A programming language uses a collection of symbols, words, and phrases


that instruct a computer to perform specific operations. While content-
markup languages focus on assigning meaning to different pieces of content,
programming languages focus on processing data and information for a wide
variety of different types of applications such as C++ programming
language. Once the program has been coded, the next step is testing, or
debugging, the program.

Step 4: Program Test


Debugging refers to the process of testing and then eliminating errors It
means running the program on a computer and then fixing the parts that do

6
Lecture 5 Computer Principles

not work. Programming errors are of two types: syntax errors and logic
errors.

Syntax Errors
A syntax error is a violation of the rules of the programming language. For
example, in C ++, each statement must end with a semicolon (;). If the
semicolon is omitted, the program will not run due to a syntax error.

7
Lecture 5 Computer Principles

Logic Errors
A logic error occurs when the programmer uses an incorrect calculation or
leaves out a programming procedure. For example an endless loop.
Step 5: Program Documentation
Documentation consists of written descriptions and procedures about a
program and how to use it. It is not something done just at the end of the
programming process. Program documentation is carried on throughout all
the programming steps. This documentation is typically within the program
itself and in printed documents. In this step, all the prior documentation is
reviewed, finalized, and distributed. Documentation is important for people
who may be involved with the program in the future.

• Users: Users need to know how to use the software. Some


organizations may offer training courses to guide users through the
program. However, other organizations may expect users to be able to

8
Lecture 5 Computer Principles

learn a package just from the written documentation. Two examples


of this sort of documentation are printed manuals and the help option
within most applications.
• Operators: Documentation must be provided for computer operators.
If the program sends them error messages, for instance, they need to
know what to do about them.
• Programmers: As time passes, even the creator of the original
program may not remember much about it. Other programmers
wishing to update and modify it that is, perform program maintenance
may find themselves frustrated without adequate documentation. This
kind of documentation should include text and program flowcharts,
program listings, and sample output. It also might include system
flowcharts to show how the particular program relates to other
programs within an information system.
Step 6: Program Maintenance
T he final step is program maintenance. As much as 75 percent of the total
lifetime cost for an application program is for maintenance. This activity is
so commonplace that a special job title, maintenance programmer, exists.
The purpose of program maintenance is to ensure that current programs are
operating error free, efficiently, and effectively. Activities in this area fall
into two categories: operations and changing needs.
Operations
Operations activities concern locating and correcting operational errors,
making programs easier to use, and standardizing software using structured
programming techniques. For properly designed programs, these activities
should be minimal.

9
Lecture 5 Computer Principles

Changing Needs
All organizations change over time, and their programs must change with
them. Programs need to be adjusted for a variety of reasons, including new
tax laws, new information needs, and new company policies. Significant
revisions may require that the entire programming process begin again with
program specification.

 Generations of Programming Languages


There are five generations of programming languages: (1) machine
languages, (2) assembly languages, (3) procedural languages, (4) task-
oriented languages, and (5) problem and constraint languages.
Machine Languages: The First Generation
Machine code is represented as binary data. All programming is represented
by 1s and 0s, since inside the computer only 1 or 0 (on or off) had any
meaning within the circuits.

10
Lecture 5 Computer Principles

To see how hard this is to understand, imagine having to read this:


00010101001110111100111000001111101000001111
Assembly Languages: The Second Generation
Before a computer can process or run any program, the program must be
converted or translated into machine language. Assembly languages use
abbreviations or mnemonics such as ADD that are automatically converted
to the appropriate sequence of 1s and 0s. Compared to machine languages,
assembly languages are much easier for humans to understand and to use.
ADD 210(8,13),02B(4,7)
This is still pretty obscure, of course, and so assembly language is also
considered low level. Assembly languages also vary from computer to
computer. With the third generation, we advance to high-level languages,
many of which are considered portable languages. That is, they can be run
on more than one kind of computer they are “portable” from one machine to
another.
High-Level Procedural Languages: The Third Generation
People are able to understand languages that are more like their own (e.g.,
English) than machine languages or assembly languages. These more
English like programming languages are called “high-level” languages.
However, most people still require some training to use higher-level
languages. This is particularly true of procedural languages. Procedural
languages, also known as 3GLs (third-generation languages), are
designed to express the logic the procedures that can solve general problems.
Procedural languages, then, are intended to solve general problems. C ++ is
a procedural language widely used by today’s programmers. Consider the
following C ++ statement from a program that assigns letter grades based on
the score of an exam.
11
Lecture 5 Computer Principles

if (score > = 90) grade = ‘A’;


Task-Oriented Languages: The Fourth Generation
Third-generation languages are valuable, but they require training in
programming. Task-oriented languages, also known as 4GLs (fourth-
generation languages) and very high level languages, require little special
training on the part of the user. Unlike general-purpose languages, task-
oriented languages are designed to solve specific problems. While 3GLs
focus on procedures and how logic can be combined to solve a variety of
problems, 4GLs are nonprocedural and focus on specifying the specific tasks
the program is to accomplish. 4GLs are more English like, easier to
program, and widely used by nonprogrammers. Some of these fourth-
generation languages are used for very specific applications.
• Query languages: Query languages enable nonprogrammers to use
certain easily understood commands to search and generate reports
from a database. One of the most widely used query languages is SQL
(structured query language). For example, let’s say that Advantage
Advertising has a database containing all customer calls for service
and that their management would like a listing of all clients who
incurred overtime charges. The SQL command to create this list is
SELECT client FROM dailyLog WHERE serviceEnd > 17
SQL statement selects or identifies all clients (a field name from the
dailyLog table) that required service after 17 (military time for 5:00
P.M.)
• Application generators: An application generator or a program
coder is a program that provides modules of prewritten code. When
using an application generator, a programmer can quickly create a
program by referencing the module(s) that performs certain tasks.
12
Lecture 5 Computer Principles

This greatly reduces the time to create an application. For example,


Access has a report generation application and a Report wizard for
creating a variety of different types of reports using database
information.
Problem and Constraint Languages: The Fifth Generation
As they have evolved through the generations, computer languages have
become more humanlike. Clearly, the fourth-generation query languages
using commands that include words like SELECT, FROM, and WHERE are
much more humanlike than the 0s and 1s of machine language. However,
4GLs are still a long way from the natural languages such as English and
Spanish that people use. The standard definition of a fifth-generation
language (5GL) is a computer language that incorporates the concepts of
artificial intelligence to allow a person to provide a system with a problem
and some constraints, and then request a solution. Additionally, these
languages would enable a computer to learn and to apply new information
as people do. Rather than coding by keying in specific commands, we would
communicate more directly to a computer using natural languages.
Consider the following natural language statement that might appear in a
5GL program for recommending medical treatment.
Get patientDiagnosis from patientSymptoms “sneezing”, “coughing”,
“aching”

13

You might also like