You are on page 1of 30

INTRODUCTION TO PROGRAMMING

By:
Course Instructor

Recommended Textbooks
1. Joyce Farrell “Object Oriented Programming Using C++”, 4th
Edition, Cengage, 2009
2. Paul Deitel & Harvey Deitel “How to Program C++” 8th Edition,
Pearson Prentice, 2012
INTRODUCTION TO PROGRAMMING

 Program: A program is a set of instructions written for


the computer to perform a specific task.

 Program can also be define as a set of instructions or


codes written in the language of a computer, that is,
Machine/Binary Language (0s and 1s).

 Software is the general name given to all computer


programs.

 Software can also be defined as the umbrella term for all


programs and applications found on the computer.
INTRODUCTION TO PROGRAMMING

 Hence software is the set of instructions or codes written


in the any language for the computer to read,
understand and execute.

 Computer Program and Software are the same and can


be used interchangeably

 Relevance / Importance of Computer Programs/Software


 Computer Programs and applications are used widely in
every aspect of society namely;
 Education Agricultural Religious
 Research Finance & Investment Engineering
 Entertainment Banking & Accounts Industry
 Marketing Building & Construction Health & Medical
 Exploration Simulation/Visualisation Gamification etc
INTRODUCTION TO PROGRAMMING

 What is Programming:
 Programming is the act or process of writing instructions
or codes for the computer perform a specific task. It is a
way of telling the computer how to read and execute
instructions or codes.

 Programming can also be defined as the process of


developing computer programs or applications. It is the
process of writing instructions in the language of the
computer.
 Computers like human beings; also have the language
that it reads, understands and execute.

 Programming can also be termed as Coding.


INTRODUCTION TO PROGRAMMING

 Who is a Programmer: A Software Programmer is a


person who writes instructions or codes for the computer
to read, understand and execute. Eg. A human being or Robot

 Other names of programmers include; Software


Developer, Application Developer, Software Engineer etc

 Qualities of a Programmer: A programmer should be;


 Creative/Innovative: Be able to device new ideas
 Problem Solver: Be able to solve problems
 Critical Thinker: Think deep or thoroughly about issues
 Logical Reasoner: Apply math rules in solving problems
 Computer Literate: Understand computers and how they
operates so as to write commands for them
PROGRAMMING LANGUAGES

 What is a Programming Language:


 A programming language is a computer language which
is used to write instructions or codes for the computer to
perform a specific task.

 Computers have a language which they can read,


understand and execute. The language of the computer
is Binary or Machine language (0s and 1s). Eg. 110011

 Programming languages have been developed to help


overcome the difficulties and challenges associated in
writing programs in Binary language (0s and 1s)

 Programming languages are used to write instructions or


codes efficiently in the language of the computer.
PROGRAMMING LANGUAGES

 A programming language is the basic tool of all software


programmers. All software or programs are written in a
programming language. Programming languages have
its own set of rules that provides a way of telling a
computer what operations to perform. It is a formal
notation for expressing algorithms. It provides a
linguistic framework for describing computations.

 Every language has its own Syntax and Semantics


 For example, the human language such as English has its own
words, symbols and grammatical rules. The words and symbols
have their meanings in the language.
 A programming language also has words, symbols and
grammatical rules. The grammatical rules are called syntax
and the meanings are called semantics. Each programming
language has a different set of syntax rules and semantics.
EVOLUTION OF PROGRAMMING
LANGUAGES?

 Why so many programming languages?


 Like natural or human languages; we have different
programming languages and new ones are been
developed everyday in the world. Every programming
languages is targeted at a particular problem domain or
solution space.
 Programming languages have evolved over time as
better ways have been sought to design and develop
them to meet changing user demands and societal
problems.
 The first programming languages were developed in the
1950s and since then thousands of languages have been
developed.
 Different programming languages are designed for
different types of programs.
LANGUAGE FAMILY
CLASSIFICATION OF PROGRAMMING
LANGUAGES

 Programming Languages can be classified;

 By Level:
 High Level Programming Language
 Low Level Programming Language

 By Generation
 First
 Second
 Third
 Fourth
 Fifth
 Beyond the Fifth
CLASSIFICATION OF PROGRAMMING
LANGUAGES: LEVEL

 High Level Programming Language


 A high level programming language is a language which
is closer to human understanding.

 Examples of high level language includes;


 C/C++, Java, VB, PHP etc

 Class Triangle
 {
 float base, height, area;
 area=base*height;
 cout<<Area is <<area;
 return 0;
 }
CLASSIFICATION OF PROGRAMMING
LANGUAGES: LEVEL

 Low Level Programming Language


 A Low level programming language is a language which
is closer to computer or machine language.

 Examples of low level languages includes;


 Assembly Language or Machine Language

 LOAD x, y
 ADD m, n
 MUL r1, r2
 DIV r1, r2
 STOR r1, z
 RET h
CLASSIFICATION OF PROGRAMMING
LANGUAGES: LEVEL

 Executable Machine Language/Code

Example 1

10001001 11001010
11101010 10101001
10011110 10111011
11001010 11010010
11010100 10110010
10101001 10010011
CLASSIFICATION OF PROGRAMMING
LANGUAGES: GENERATION

 First Generation Languages (1GL)

 Second Generation Languages (2GL)

 Third Generation Languages (3GL)

 Fourth Generation Languages (4GL)

 Fifth Generation Languages (5GL)

 Beyond the Fifth Generation


First Generation Languages: 1GL

 Machine / Binary language


 Machine language is machine dependent as it is the only
language the computer can understand.
 It is very difficult to write, read and edit this language.

 Example:
1010 1001 1000 1001
1000 1010 1011 1100
1101 1110 1001 1110
1011 1010 1110 1111
1100 1110 1000 1101
1011 1001 1011 1011
Second Generation Languages: 2GL

 Assembly languages
 Symbolic operation codes are replaced by binary
operation codes.
 Assembly language programs need to be converted by
the assembler for execution by the computer. Each
assembly language instruction is translated into one
machine language instruction.
 Assembly language is much easier to write than Binary.

 Example;
LOAD X
ADD R1, R2
STOR x, R3
DIV X, Y
Third Generation Languages: 3GL

 A high level language closer to human understanding. It


uses simple mathematical notations.
 Programs in source code must be translated into
machine language programs called object code.
 The translation of source code to object code is
accomplished by a machine language system program
called a compiler.
 Alternative to compilation is interpretation which is
accomplished by a system program called an interpreter.
Some common third generation languages;
 C/C++
 Java
 PHP
 VB etc
Fourth Generation Languages: 4GL

 A high level language that requires fewer instructions to


accomplish a task than a third generation language.

 Fourth generation languages are used for;

 Database applications

 Form generators

 Query generators

 Report designers
Fifth Generation Languages: 5GL

 Fifth generation languages are used for;

 Artificial Intelligence / Reasoning

 Intelligent Programming

 Declarative languages

 Functional: Everything is a function


 E.g. Lisp, Scheme, SML

 Logical: Based on mathematical logic or rule


 E.g. Prolog
Beyond Fifth Generation Languages

 Agent Oriented Programming: Agent-oriented


programming (AOP) is a programming paradigm where
the construction of the software is centered on the
concept of software agents.

 Intentional Programming: Intentional programming is


a collection of concepts which enable software source
code to reflect the precise information, called intention,
of the programmers.

 Natural language programming: Natural language


programming is a way of writing programs using natural
or human language sentences.
 **Maybe you will invent the next generation computer
programming language**
PROGRAMMING LANGUAGE PARADIGMS

 Programming Paradigm: The approach of writing


computer programs. There are many approaches of
writing or developing computer programs.

 Some examples of programming paradims;

 Procedural Programming

 Object Oriented Programming

 Imperative Programming

 Declarative Programming
PROGRAMMING LANGUAGE PARADIGMS

 Procedural (Traditional) programming: Approach to


writing programs in which data and functions are
separated. It mostly use sequences of instructions E.g
1GL, 2Gl, 3GL etc
 Object oriented programming: Approach to writing
programs in which software is model as a real world
object. It combines both data and functions together.
Eg.3GL, 4GL, 5GL etc
 Imperative Programming: Languages with facilities
for assigning values to memory locations. E.g. C, C++,
Java, PHP,VB etc
 Declarative Programming: Languages that use
functions in which the programmer does not consider the
assignment of values to memory locations. E.g. Logic,
Lisps, Database etc
PROGRAMMING LANGUAGE PARADIGMS
LANGUAGE THEORY

 Programming languages are like natural languages


 When it comes to mechanics of the task, learning to
speak and use a programming language is in many ways
like learning to speak a human language
 In both kind of languages you have to learn new
vocabulary, syntax and semantics (new words, sentence
structure and meaning)
 And both kind of language require considerable practice
to make perfect.
 But there is a difference;
 Computer languages lack ambiguity and vagueness
 For example, in English sentences such as “Take a pinch
of salt” are ambiguous
 In a programming language a sentence either means
one thing or it means nothing.
LANGUAGE THEORY

 A language provides a means of communication between


people who need to have a common understanding of
the programming languages.
 Those involve includes;
 Language designers / creators / formulators etc
 Language users / implementers / programmers etc

 What to specify in the language?


 A Language specification includes;
 Syntax: Rules
 Semantics: Meanings
 Contextual constraints
 Scope rules
 Type rules
LANGUAGE PROCESSING & THEORY
LANGUAGE PROCESSING & THEORY

 Compiler: Converts a program written in high level


language to low level at once. It takes a program in high
level language and run it immediately E.g. gcc, g++

 Interpreter: Converts a program written in high level


language to low level line by line. E.g. javac, yacc

 Assembler: Converts assembly language to machine


language. Assembler translates a source code written in
assembly language to machine language.
LANGUAGE PROCESSING & THEORY

 Programming Language Processor is any computer


system (software) that manipulates sets of instructions
that computers can understand (programs)

 Editors allow a program text to be entered, modified and


saved in a file. E.g. Notepad, Notepad++ etc.

 Translators translate a text from one language to


another language E.g. Google Translator

 Integrated Development Environment E.g., Borland


JBuilder, Eclipse, Visual Studio .NET
GENERAL KNOWLEDGE IN COMPUTERS

 Computer Software: Generic name for all computer


programs or sets of instructions that the computer CPU
understands and can execute. Two main types;

 System Software: Master software that controls and manage


computer resources such as hardware, memory, HDD, drives,
printer and software etc. E.g. Operating systems, Drivers etc

 Application Software: Use to perform specific tasks on the


computer. E.g. Ms Word, Ms Excel, PowerPoint, Access etc

 Computer Hardware: Generic name for all computer parts


that can be physical touched and repaired. E.g. keyboard,
monitor, system unit, mouse, printer, scanner etc.
THE END
 T o b e c o n t i n u e d………………………

You might also like