Fundamentals of Programming
Introduction
By
Tusabe Lawrence
(Let’s Learn Programming)
Introduction to Programming
When programs are developed to solve real-life problems
like inventory management, payroll processing, student
admissions, examination result processing, etc.
They tend to be huge and complex.
The approach to analysing such complex problems,
planning for software development and controlling the
development process is called programming
methodology.
01/21/2026 Programming Methodology by T. Lawrence 2
Introduction to Programming
Programming: The art of writing computer programs.
A program: A set of instructions to be carried out by a
computer.
program execution: The act of carrying out the
instructions contained in a program.
In programming, we study the problem at hand, look for
the solution to the problem and implement that solution
using a particular programming language.
01/21/2026 Programming Methodology by T. Lawrence 3
Programming languages
A programming language:
Is a language that a computer can understand and provides
a programmer an environment to write and execute
programs in it.
A number of programming languages exist but the choice
mainly depends on the nature of the problem at hand and the
programmer’s ability to use the language.
Note: Computers do not understand human languages, so
programs must be written in a language a computer can use.
01/21/2026 Programming Methodology by T. Lawrence 4
Revolution of programming languages
There has been a great revolution in programming languages
right from the time when programming started.
1. The first generation involved the use of machine language,
2. The second involved the use of assembly language,
3. Third generation involved high-level programming languages like C,
C++, Java
4. Forth generation involved languages mainly used for database
manipulation like Structured Query Language (SQL)
5. Fifth generation involved languages mainly used for artificial
intelligence and neural networks like ProLog and LISP
01/21/2026 Programming Methodology by T. Lawrence 5
Machine language
Machine language consists of binary sequences of 0's and 1's which
represent an instruction in the control logic of a CPU, often expressed in
hexadecimal (base 16) for clarity. It is different for each machine (i.e.
machine dependent).
All programs must be written in machine language (code) or translated
into machine language before being executed by the machine.
For example: A program that adds over time pay to base pay and stores the
result in gross pay could look like this one below.
…………………………..
+1300042774
+1400593419
+1200274027
01/21/2026
…………………………… Programming Methodology by T. Lawrence 6
Assembly language
As you can see from the above example, machine language
instructions would be cumbersome for humans. That is why the
assembly language came into programming to make life easier.
Assembly languages use short abbreviations (mnemonics)
corresponding to machine language
Example corresponding to the above machine code could be
…………………………………………
• Load Basepay
• Add OverPay
• Store GrossPay
…………………………………………..
01/21/2026 Programming Methodology by T. Lawrence 7
High-level Languages (HLL)
Writing programs in Assembly language was a bit easy but
these required many instructions to accomplish even the
simplest tasks. HLL codes are similar to everyday English
language which makes it easier for programmers to understand.
HLLs are machine independent and must be interpreted or
compiled.
• HLLs use mathematical notations (translated via compilers)
• E.g GrossPay = basepay + overTimePay
Compiler: programs that translate high level language
instructions into machine code for later execution.
01/21/2026 Programming Methodology by T. Lawrence 8
High-level Languages (HLL)
• They are platform independent, which means that you
can write a program in a high-level language and run it in
different types of machines.
• High-level languages are English-like and easy to learn
and use.
• The instructions in a high-level programming language
are called statements.
• Interpreters: They translate a small part of the source
and execute them one by one. Interpreters are mainly
used to interpret the source code for scripting languages.
01/21/2026 Programming Methodology by T. Lawrence 9
Popular High-Level Programming
Languag Description
Languages
e
Ada Named for Ada Lovelace, who worked on mechanical general-purpose
computers. The Ada language was developed for the Department of
Defense and is used mainly in defense projects.
BASIC Beginner’s All-purpose Symbolic Instruction Code. It was designed to
be learned and used easily by beginners.
C Developed at Bell Laboratories. C combines the power of an assembly
language with the ease of use and
portability of a high-level language.
C++ C++ is an object-oriented language, based on C.
C# Pronounced “C Sharp.” It is a hybrid of Java and C++ and was
developed by Microsoft.
COBOL Common Business Oriented Language. Used for business
applications.
01/21/2026 Programming Methodology by T. Lawrence 10
Popular High-Level Programming
Languages
Language Description
FORTRAN FORmula TRANslation. Popular for scientific and mathematical
applications.
Java Developed by Sun Microsystems, now part of Oracle. It is widely
used for developing platform-independent Internet applications.
Pascal Named for Blaise Pascal, who pioneered calculating machines in the
seventeenth century. It is a simple, structured, general-purpose
language primarily for teaching programming.
Python A simple general-purpose scripting language good for writing short
programs.
Visual Visual Basic was developed by Microsoft and it enables the
Basic programmers to rapidly develop graphical user
interfaces.
01/21/2026 Programming Methodology by T. Lawrence 11
Classifications of Programming
languages
Programming languages are classified based on what they are
able to do. For example, we have classifications like Procedural
languages, object-oriented languages and scripting languages
e.t.c
• Procedural Programming Languages
– Procedural programming is a programming paradigm based upon the
concept of the modularity and scope of program code (i.e., the data
viewing range of an executable code statement). A main procedural
program is composed of one or more modules (also called packages or
units), either coded by the same programmer or pre-coded by someone
else and provided in a code library.
– Each module is composed of one or more subprograms (which may
consist of procedures, functions, subroutines or methods, depending on
programming language).
01/21/2026 Programming Methodology by T. Lawrence 12
– Examples include, C, FORTRAN ,Ada, and ALGOL.
Object-Oriented Programming Languages
• An object-oriented programming language is one that allows or
encourages, to some degree, object-oriented programming
methods. These languages include
– "pure" object-oriented languages such as Smalltalk, Eiffel and
Ruby, which were designed specifically to facilitate - even
enforce - object-oriented methods
– languages such as Java and Python, which are primarily designed
for object-oriented programming but have some procedural
elements; and
– languages such as C++, Fortran 2003, and Perl, which are
historically procedural languages that have been extended with
some object-oriented
01/21/2026
features.
Programming Methodology by T. Lawrence 13
Scripting Programming Languages
• Scripting languages or script languages are computer programming
languages designed for "scripting" the operation of a computer. Early
script languages were often called batch languages or job control
languages.
• Many scripting languages emerged as tools for executing one-off tasks,
particularly in system administration. One way of looking at scripts is as
"glue" that puts several components together; thus they are widely used
for creating graphical user interfaces.
• Scripting languages tend to be interpreted rather than compiled, which
means that you don't need to compile them - they're compiled "on the fly
• Examples include: PHP, Perl, JavaScript, Coldfusion, e.t.c
01/21/2026 Programming Methodology by T. Lawrence 14
Check point
A program written in a high-level language is called a source
program or source code. Because a computer cannot
execute a source program, a source program must be
translated into machine code for execution.
The translation can be done using a programming tool called
an interpreter or a compiler.
An interpreter reads one statement from the source code,
translates it to the machine code or virtual machine code, and
then executes it right away.
A compiler translates the entire source code into a machine-
code file, and the machine-code file is then executed.
01/21/2026 Programming Methodology by T. Lawrence 15
Types of Programming Methodologies
• Procedural Programming
– Problem is broken down into procedures, or blocks of code
that perform one task each. All procedures taken together
form the whole program. It is suitable only for small programs
that have low level of complexity.
– Example
For a calculator program that does addition, subtraction,
multiplication, division, square root and comparison, each of these
operations can be developed as separate procedures. In the main
program each procedure would be invoked on the basis of user’s
choice.
01/21/2026 Programming Methodology by T. Lawrence 16
Types of Programming Methodologies
• Object-oriented Programming
– Here the solution revolves around entities or objects that are
part of problem. The solution deals with how to store data
related to the entities, how the entities behave and how they
interact with each other to give a cohesive solution.
– Example − If we have to develop a payroll management
system, we will have entities like employees, salary
structure, leave rules, etc. around which the solution must
be built.
01/21/2026 Programming Methodology by T. Lawrence 17
Types of Programming Methodologies
• Functional Programming
– Here the problem, or the desired solution, is broken down
into functional units. Each unit performs its own task and is
self-sufficient. These units are then stitched together to
form the complete solution.
– Example − A payroll processing can have functional units
like employee data maintenance, basic salary calculation,
gross salary calculation, leave processing, loan repayment
processing, etc.
01/21/2026 Programming Methodology by T. Lawrence 18
Types of Programming Methodologies
• Logical Programming
– Here the problem is broken down into logical units
rather than functional units.
Example:
– In a school management system, users have very defined roles
like class teacher, subject teacher, lab assistant, coordinator,
academic in-charge, etc. So the software can be divided into
units depending on user roles. Each user can have different
interface, permissions, etc.
01/21/2026 Programming Methodology by T. Lawrence 19
(a) Interpreter & (b) Compiler
01/21/2026 Programming Methodology by T. Lawrence 20
Check point
1. What language does the CPU understand?
2. What is an assembly language?
3. What is an assembler?
4. What is a high-level programming language?
5. What is a source program?
6. What is an interpreter?
7. What is a compiler?
8. What is the difference between an interpreted language and a
compiled language?
01/21/2026 Programming Methodology by T. Lawrence 21
Syntax
• Syntax means the rules that dictate how exactly the vocabulary
elements of the language can be combined to form statements.
• Each programming language has its own unique syntax.
• For example, in English we know that a sentence must end with a
question mark, a full stop or an exclamation mark. That is the
rule that must be obeyed
• During compilation, all syntax rules are checked. If a program is not
syntactically correct, the compiler will issue error messages. Such errors
could be like attempt to add two integers but the addition operator in not
put between them or forgetting to close a procedure/function.
01/21/2026 Programming Methodology by T. Lawrence 22
Semantics
• The semantics of a statement in a programming
language define what will happen when that statement
is executed. In other words, semantics refer to the
meaning of the statement.
• Programming languages are generally unambiguous,
which means the semantics are well defined. This
means there’s only one and only one interpretation of
each statement. Natural languages e.g. French and
English are full of ambiguities.
01/21/2026 Programming Methodology by T. Lawrence 23
Program Errors
You will encounter three types of errors as you develop programs
• Compile time errors: These are errors identified by the compiler
when it is compiling your program. They may include syntax errors
and wrong data types. A program will not execute until when a
compile time error is corrected.
• Runtime errors: These occur during the execution of a program
and cause a program to abort abnormally e.g. division by zero,
infinite looping.
• Logical errors: The program compiles and runs normally but it
produces wrong results. A logical error may occur when:
– A value is calculated incorrectly e.g instead of addition you
subtract.
01/21/2026– When a graphical Programming
button Methodology
does not by [Link]
Lawrence in the correct place. 24
Check Point
1. What are syntax errors (compile errors), runtime errors, and
logic errors?
2. Give examples of syntax errors, runtime errors, and logic
errors.
3. If you forget to put a closing quotation mark on a string, what
kind error will be raised?
4. If your program needs to read integers, but the user entered
strings, an error would occur when running this program. What
kind of error is this?
5. Suppose you write a program for computing the perimeter of a
rectangle and you mistakenly write your program so that it
computes the area of a rectangle. What kind of error is this?
01/21/2026 Programming Methodology by T. Lawrence 25
Debugging process
01/21/2026 Programming Methodology by T. Lawrence 26
Program development
During the program development process, the following steps must
be followed;
Step1. Understand the problem
Step2. Analyzing the problem we're given
Step3. Dissect the problem into manageable pieces
Step4. Developing a solution technique (algorithm)
Step5. Documenting the program/technique
Step6. Translating (implementing) the technique into code
Step7. Compiling and running the program
Step8. Testing the results with appropriate data
The above steps must be followed carefully. After step 8, if there are
logical errors (i.e. program running properly but results are not
correct), you must go back to step 6.
01/21/2026 Programming Methodology by T. Lawrence 27
In Summary
Programs and data are permanently stored on storage devices and
are moved to memory when the computer actually uses them.
The machine language is a set of primitive instructions built into
every computer.
Assembly language is a low-level programming language in which a
mnemonic is used to represent each machine-language instruction.
High-level languages are English-like and easy to learn and
program.
A program written in a high-level language is called a source
program.
A compiler is a software
01/21/2026 program
Programming that
Methodology by [Link]
Lawrence the source 28
program into a machine language program.