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

Lecture 1_Introd_Programming

The document outlines a course on Introduction to Programming at KCA University, detailing the course outline, learning outcomes, and assessment methods. It covers various topics including programming languages, tools, algorithms, and testing techniques. The course aims to equip learners with skills in programming, data manipulation, and software development documentation.

Uploaded by

benedictnjere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture 1_Introd_Programming

The document outlines a course on Introduction to Programming at KCA University, detailing the course outline, learning outcomes, and assessment methods. It covers various topics including programming languages, tools, algorithms, and testing techniques. The course aims to equip learners with skills in programming, data manipulation, and software development documentation.

Uploaded by

benedictnjere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

KCA University

Nairobi, Kenya

BSD 1207/BIT01203
INTRODUCTION TO PROGRAMMING

Prepared By:
Dr. Linus Aloo, PhD
E-mail: [email protected]
Phone: 0754188380
Course Text
1. Programming in ANSI C" by E. Balagurusamy (8th Edition), McGraw Hill
Education, 2019.
References
1. The C Programming Language" by Brian Kernighan and Dennis Ritchie
(2nd Edition)
2. Fundamentals of programming languages by Dipali P. Baviskar, 2010.
3. Expert C Programming: Deep C Secrets" by Peter van der Linden.
4. C++: The Complete Reference" by Herbert Schildt (4th Edition)
Introduction to Programming Lecture Notes
9/19/2024 1
By Dr. Linus .A. Aloo
INTRODUCTION TO PROGRAMMING

COURSE OUTLINE
Chapter 1: History of Programming: Language models, evaluating languages, chronology of
programming, language generations.
Chapter 2: Programming Tools and Implementation: Translators, Traditional Systems lifecycle,
SDLC, need for documentation and coding standards, attributes of good documentation.
Chapter 3: Data Analysis and Problems: Program development process: program specification,
requirement analysis, design coding and analysis, implementation, and support.
Chapter 4: Algorithms, structured diagrams and structured walkthrough.
Chapter 5: Variables Controls Structures and calculations: Variable types and names, sequence,
selection, loops.
Chapter 6: Programming Techniques: Procedures and Functions, Arrays:- one-dimensional
arrays, two-dimensional array, array processing.
Chapter 7: Testing: Why testing, levels of testing, unit, integration, systems, acceptance testing,
and installation tests. Desk checking and dry running.
Introduction to Programming Lecture Notes
9/19/2024
By Dr. Linus .A. Aloo 2
•INTRODUCTION TO PROGRAMMING
Course Learning Outcomes
• Up successfully completion of this course unit, the learner should be able to
demonstrate a satisfactory performance in the following areas:

• Placing context development in programming languages and reasons for


their evolutions

• Recognize and apply appropriate ways to control and manipulate data

• Break down and formulate data into structures appropriate for the problem
to be addressed

• Define and apply a range of testing approaches to check the correctness of


programming code

• Put programming activities into the context of software development as a


whole with emphasis on the importance of documentation
9/19/2024
•INTRODUCTION TO PROGRAMMING
Course Outline
Learning & Teaching Methodologies
Lectures, tutorials and planning exercises
Instructional Materials/Equipment
Classroom with audio visual aids
Computer laboratory
Course Assessment
BSD Introduction To Programming
1207/BIT01203
Course Assessment Type Weighting (%)
Lab Ass I 5%

Lab Ass II 5%

Lab Ass II 10 %

CATs-CAT 1&2 30 %

END SEM EXAMS 50%

TOTALS 100%
9/19/2024
CHAPTER ONE: INTRODUCTION

• 1.1. Introduction

• A computer program is a sequence of instructions written using a


Computer Programming Language to perform a specified task by
the computer.

• A computer program is a software usually written by a


programmer to solve user problems on the computer.

• Programming refers to the process of developing computer


instructions (programs) used to solve a particular task. It involves
use of special characters, signs and symbols found in a particular
programming language to create computer instructions.

Introduction to Programming Lecture Notes


9/19/2024 5
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.1. Introduction

• Computer programming (often shortened to programming or coding)


is the process of writing, testing, debugging/troubleshooting, and
maintaining the source code of computer programs. This source code is
written in a programming language.

• Each language has a special sequence or order of writing characters,


usually called syntax.

• The main function of a computer program is to process data. This data


usually originates from outside the computer and must be loaded into the
computer memory before being processed.

Introduction to Programming Lecture Notes


9/19/2024 6
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.1. Introduction
Qualities of a good program
• Accuracy: the program must do what it is supposed to do and meet
the criteria laid down in its specification.
• Reliability: the program must always do what it is supposed to do
and never crash. how often the results of a program are correct.
• Efficiency: the program must use the available storage space and
resources in such a way that the system’s speed is not wasted.
• Robustness: the program should cope with invalid data without
creating errors or stopping without any indication of the cause.
• Usability: the program must be easy to use and well documented.
• Maintainability: the program must be easy to amend, having good
structuring and documentation.
• Readability: the code in the program must be well laid out and
explained with comments.

Introduction to Programming Lecture Notes


9/19/2024 7
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.2. Uses of Computer Programs
 Today computer programs are being used in almost every field,
household, agriculture, medical, entertainment, defense,
communication, etc.
 Listed below are a few applications of computer programs −
 MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome,
etc., are examples of computer programs.
 Computer programs are being used to develop graphics and special
effects in movie making.
 Computer programs are being used to perform Ultrasounds, X-Rays,
and other medical examinations.
 Computer programs are being used in our mobile phones for SMS,
Chat, and voice communication.

Introduction to Programming Lecture Notes


9/19/2024 8
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.3. Computer Programmer
 A person who can write computer programs or in other words, someone who
can do computer programming is called a Computer Programmer.
 Based on computer programming language expertise, examples of computer
programmers include−
 C Programmer
 C++ Programmer
 Java Programmer
 Python Programmer
 PHP Programmer
 Perl Programmer
 Ruby Programmer

Introduction to Programming Lecture Notes


9/19/2024 9
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4. Computer Programming Languages
 We assume you are well aware of English  Decision Making
Language, which is a well-known Human  Loops
Interface Language (HIL).  Numbers
 English has a predefined grammar, which
 Characters
needs to be followed to write English
statements correctly.  Arrays
 Similar to HIL, Computer Programming  Strings
Languages are also made of several  Functions
elements.  File I/O
 The following are the basics of those
elements used in various programming  Programming
languages: Environment
 Basic Syntax
 Data Types
 Variables
 Keywords
 Basic Operators

Introduction to Programming Lecture Notes


9/19/2024 10
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4. Computer Programming Languages
 We assume you are well aware of English Language, which is a well-
known Human Interface Language (HIL).
 English has a predefined grammar, which needs to be followed to write English
statements correctly.
 Similar to HIL, Computer Programming Languages are also made of several
elements.
 The following are the basics of those elements used in various programming
languages:
 Programming  Decision Making
Environment  Loops
 Basic Syntax  Numbers
 Characters
 Data Types  Arrays
 Variables  Strings
 Keywords  Functions
 Basic Operators  File I/O

Introduction to Programming Lecture Notes


9/19/2024 11
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4. Computer Programming Languages

 Instruction: Directions that a Computer language


microprocessor follows to execute a
task or part of a task. High Level Low Level

 Program: A set of instructions


written to solve a problem. Assembly Language
 A program can be written in a variety of Machine Language  English Alphabets
 ‘Mnemonics’
programming languages. The languages  Binary bits
 Assembler
are broadly classified into two Mnemonics 
Machine
categories: Language
 Low-level languages which refers to the machine language and assembly language
 High-level languages which refers to languages that are machine-independent and thus can
be run on different types of machines. They use a series of English-like words to write
instructions. Example is C++ program, COBOL, FORTRAN, BASIC,C 4GLs etc

Introduction to Programming Lecture Notes


9/19/2024 12
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.4.1. Low-level languages


 Machine language
•The first generation computer.
•Codes that consisted of 0’s and 1’s.
•Only language computer understands directly that uses binary digits.
Advantages:
–Execution is fast since there is no interpretation
Disadvantages:
–Programmers have to write computer programs using 0’s and 1’s which are difficult
to read and debug
–Whole process is tedious
–Time consuming
–Error prone
–It is designed for a specific machine and specific microprocessor

Introduction to Programming Lecture Notes


9/19/2024 13
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.4.1. Low-level languages

Assembly language (or simply assembly)


 Assembly language (or simply assembly) is a low-level programming language,
which uses mnemonics, instructions, and operands to represent machine code.
 This was a second-generation language developed in English-like acronyms to
speed programming. Words like ADD, SUB, etc., could be used in programs, and
a program called an assembler translated these words into machine language.

Advantages of Assembly Language


Having an understanding of assembly language makes one aware of −
 How programs interface with OS, processor, and BIOS;
 How data is represented in memory and other external devices;
 How the processor accesses and executes instruction;

Introduction to Programming Lecture Notes


By Dr. Linus .A. Aloo
9/19/2024 14
CHAPTER ONE: INTRODUCTION

1.4.1. Low-level languages


 Assembly
 How instructions access and process data;
 How a program accesses external devices.
Other advantages of using assembly language are −
 It requires less memory and execution time;
 It allows hardware-specific complex jobs more easily;
 Assembly language has closer control over the computer hardware and executes
very efficiently.
 It is therefore useful for writing operating systems and game programs which
require fast and efficient use of the CPU.

Disadvantage:
Platform Specific: This implies that programs cannot be moved from one computer
architecture to another without re-writing the code.

Introduction to Programming Lecture Notes


By Dr. Linus .A. Aloo
9/19/2024 15
CHAPTER ONE: INTRODUCTION
1.4.2. High level Languages
• Popularly known as 3rd Generation Languages (3GLs)
– Advantages

• High level languages are portable i.e. they are transferable from one computer to another.

• High level languages are user friendly and easy to use and learn.

• Are more flexible, hence they enhance the creativity of the programmer and increase
productivity in the workplace.

• High level languages are far much easier to correct errors (debug).
– Disadvantages

• Their nature encourages the use of many instructions in a word or statement hence the
complexity of these instructions causes slower program processing.

• They have to be interpreted or compiled to machine readable form before the computer can
execute them.

Introduction to Programming Lecture Notes


9/19/2024 16
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4.2. High-level Languages

The most popular high-level languages are as follows:

1. FORTRAN (FORmula TRANslation)

 It was developed in 1956 to provide an easier way of writing scientific and engineering applications.
FORTRAN is especially useful in processing numeric data.

FORTRAN has a standard and is therefore portable, and is widely used. It is not suited for business
applications.

2. COBOL (Common Business Oriented Language)

 This came into use in the early 1960s.

COBOL was designed with business and commercial data processing in mind.

The advantages of COBOL are its wide use, capability of using it on different types of computers,
and a pool of skilled programmers.

However, the structure of a COBOL program is such that even simple programs are long.

Introduction to Programming Lecture Notes


9/19/2024 17
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4.2. High-level Languages

3. BASIC (Beginners All-purpose Symbolic Instruction Code)

It was developed in 1964 by John Kemeny and Thomas Kurtz to teach students how to use computers.

Today it is a common language on microcomputers. BASIC can do almost all computer processing tasks.

There are too many dialects of BASIC, and therefore, has no standard.

Some of the versions offer limited facilities in terms of structured programming and meaningful variable
names.

4. PASCAL

It was developed in the early 1970s as a tool for teaching programming by Swiss computer science professor
Niklaus Wirth.

Today PASCAL is the most widely used language for teaching programming. PASCAL has strict variable
typing and declarations.

It uses procedures and functions which allows a “top-down” approach to solving problems.

However, due to its strict style, it is not easy to learn and is poor on data file handling.

Introduction to Programming Lecture Notes


9/19/2024 18
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.4.2. High-level Languages


5. C.
 In the mid-1970s, programmers at Bell Laboratories developed a
language called C.
 This is a powerful language that like Assembly Language, permits
direct control over the hardware, but like high-level languages, it
also has powerful commands that permit the rapid development of
programs.
 It is closely linked to the popular UNIX operating system and is the
ideal tool for systems programming.
 The only disadvantage is that it is difficult to read and learn.
Introduction to Programming Lecture Notes
9/19/2024 19
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.4.2. High-level Languages


6. LISP.
 LISP was developed in the late 1950s by John McCarthy of M.I.T.
 It is the pre-eminent language used in artificial intelligence.
 The name is derived from “list processing”, since both programs and
data are structured as lists.
 However, it is not suitable for commercial data processing and
interactive programming.

Introduction to Programming Lecture Notes


9/19/2024 20
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION

1.4.2. High-level Languages


7. PROLOG
 PROLOG ( PROgramming in LOGic) is a language developed from LISP by the
Japanese.
 It is designed for use with Expert systems and Artificial Intelligence. it is used
for solving problems which involve objects and relationships between objects.
Like LISP it is not suitable for commercial data processing and is not widely
available or known by many programmers.
8. LOGO
 LOGO was designed for educational use in which children can explore and
develop concepts through programming the movement of a pen.
 It has no commercial application.

Introduction to Programming Lecture Notes


9/19/2024 21
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4.3. Fourth Generation Languages
 4th Generation Languages (4GLs) started appearing from mid-1970s,
and were designed to meet the following objectives:
–Speed up the application-building process, thereby increasing
programmer productivity.
–Enable quick and easy amendment and alterations
–Reduce development and maintenance costs
–Generate bug-free code from high-level expressions of
requirements
–Make languages user-friendly
–Allow non-professional end users to develop their own solutions.
Introduction to Programming Lecture Notes
9/19/2024 22
By Dr. Linus .A. Aloo
CHAPTER ONE: INTRODUCTION
1.4.3. Fourth Generation Languages
•4GLs may be classified as Query Languages such as Structured Query
Languages (SQL), Report Generators, Application Generators,
Decision-support languages and Graphics languages.
•The Structured Query Language (SQL) makes programming a lot easier,
and provides a means of easily accessing and presenting data in a suitable
format.
Object-Oriented languages
•Some examples include; Visual Basic, Access Basic, Visual C++, Object
COBOL etc.
Internet (scripting) Programming Languages
Examples; HTML, JAVA Introduction to Programming Lecture Notes
9/19/2024 23
By Dr. Linus .A. Aloo

You might also like