SlideShare a Scribd company logo
1 of 36
PRINCIPLE & TECHNIQUES OF
PROGRAMMING I
AJAYI, O.O.
OND, B.Sc., MSc., PhD
DMA 113
COURSE OUTLINE
PART I: PROGRAMMING PRINCIPLE
• CHAPTER 1: PROGRAMMING CONCEPTS
• CHAPTER 2: PROGRAMMING STYLES
PART II: PROGRAMMING TECHNIQUES IN PYTHON
• CHAPTER 1: PROGRAMMING ENVIRONMENT
• Variables, Data Types, Statements, Assignment etc.
• CHAPTER 2: CONTROL STRUCTURE IN PYTHON
• CHAPTER 3: ARRAY & LIST PROGRAMMING IN PYTHON
• CHAPTER 4: MODULAR PROGRAMMING IN PYTHON
2
CHAPTER ONE: PROGRAMMING CONCEPTS
1.1 Programming
1.2 Programming Languages
1.3 Programming Paradigms
1.4 Programming Languages Application Domains
1.5 Programming Languages and their Inventors
1.6 Prerequisite to Programming
3
1.1 Programming & Programming Languages
• Programming can be viewed as an act of coding solution for a problem.
• It can also be defined as an act of giving instruction to the computer to
carry out a task.
• It simply implies the ability of a programmer to communicate with the
computer system in a particular programming language.
• It is a transformational act that brings about changes in the status of task –
e.g. manual task to computational one.
4
What is Programming?
- Related Concepts to Programming
• PROGRAM: This implies the written instruction, which
the computer takes in and act upon. It has the synonyms
CODE.
• PROGRAMMER: This is a person that indulges in coding
for solutions. He is regarded as an expert in writing
computer codes. His major responsible is to write
programs that performs a given or specified function.
5
Programming Languages
•These indicate the language of choice
for which the programmer
communicates with the computer
machine.
•In other words, programming language
refers to the language with which a
programmer codes.
6
Programming Languages - Types
•We have 3 types:
• Machine Language
• Low-Level Language
• High Level Language
7
Programming Languages – Types cont’d
•Machine Language (ML)
• This refers to the language which the
computer understands. It is a language in
which all codes/instructions are
represented in the form of 0s and 1s.
8
Programming Languages – Types cont’d
•Low-Level Language (LLL)
•This language is very much close to
machine language. It needs little
translator to real machine language. It is
regarded as SYMBOLIC Language. A good
and common example is the ASSEMBLY
Language.
9
Programming Languages – Types cont’d
•High-Level Language (HLL)
• This is a language that is close to normal
human English Language. It isn’t a languages
the computer understands, rather it needs the
help of an interpreter or a compiler before
computer could understand it. Examples here
includes QBasic (Quick – Beginners’ All Purpose
Symbolic and Instruction Code), Fortran
(FORmulaTRANslator), Pascal (Delphi), Java, C,
C++, C#, Python, Ada, Eiffel, PHP (Hypertext
10
Programming Paradigms
• Programming Paradigms imply trend & evolution
of programming languages.
• Early Program Development => Machine Language
• 1st Program Developed => Assembly Language
• Real Program Developed => Fortran (1954) John Backus &
IBM Team.
• Subsequent Breakthru => Algol60 (1960)
11
Programming Paradigms Cont’d…
• IMPERATIVE PROGRAMMING
This is the type of programming that deals with
scientific computation i.e. Its found useful in
handling mathematical computation. In this
programming language, assignment, sequence and
control statement are very important.
Examples of this programming paradigm are:
FORTRAN, COBOL ,C / C++ and PASCAL
12
Programming Paradigms Cont’d…
• OBJECT ORIENTED PROGRAMMING (OOP)
• This is a type of programming in which object
interact by sending messages that change their
state. In this programming type, inheritance,
polymorphism and object modeling are essential
element.
• Examples of programming languages in this
paradigm include: C++, JAVA, SMALLTALK, EIFFEL,
PHP & VISUAL BASIC.NET
13
Programming Paradigms Cont’d…
• FUNCTIONAL PROGRAMMING
• This programming paradigms deals with
mathematical functions in which the domain
serves as the input and the range serves as the
output.
• Example of this programming paradigm includes:
LISP, SCHEME, HASKEL, MIRANDA, MAPLE,
MATHEMATICA and MATLAB.
14
Programming Paradigms Cont’d…
• LOGIC / DECLARATIVE PROGRAMMING
• This programming paradigms deal with collection
of logical declaration about what outcome a
function should accomplish.
• Example of this paradigm includes: PROLOG,
SEQUEL, SQL and RPG
15
Programming Paradigms Cont’d…
• EVENT-DRIVEN PROGRAMMING
• This programming paradigms deals with design of
program that respond to unpredictable events.
• This event are normally generated from users’
actions e.g. mouse click, key press.
• Example of this paradigm includes: VISUAL BASIC,
VISUAL BASIC.NET, VISUAL C++, VISUAL C#, & JAVA
16
Programming Paradigms Cont’d…
• CONCURRENT PROGRAMMING
• This programming paradigm deals with collection
of cooperating process by sharing resources
(information) but operating asynchronously.
• Example of programming languages in this group
include: LINDA, CONCURRENT PASCAL (DELPHI),
HIGH PERFORMANCE FORTRAN and JAVA
17
Programming Language Application Domains
• These include:
i. Scientific Programming (SP)
ii. Management information system (MIS)
iii. Artificial Intelligence (AI)
iv. System Programming (SP)
v. Web-centric Programming (WP)
18
Programming Language Application Domains…
• SCIENTIFIC PROGRAMMING: This is programming
language that is used for handling complex
computations. They are also very useful for
teaching and learning. Example of this
programming language includes: FORTRAN,
COBOL, PASCAL, C and BASIC
• NOTE: Scientific programming falls under
imperative programming paradigm
19
Programming Language Application Domains…
• MANAGEMENT INFORMATION SYSTEM: This are
program that are used for handling organization
information system e.g. payroll system,
accounting system, inventory system, online sale
and marketing system. Example of this
programming language includes: SQL, COBOL and
RPG.
• NOTE: MIS falls under logic / declarative
programming paradigm
20
Programming Language Application Domains…
• ARTIFICIAL INTELLIGENCE: This are programming
types that are used to develop software that
model after human intelligent behavior e.g.
robot. Example of this programming language
includes: LISP, PROLOG, MATLAB and SCHEME.
• NOTE: AI falls under programming language
paradigm of functional and logic programming
language.
21
Programming Language Application Domains…
• SYSTEM PROGRAMMING: This is a programming type
which assist in the design and development of software
on which other software runs i.e. system programming
deals with developing software that act as platform on
which other programs runs.
• Examples are OS SOFTWARE, NETWORK SOFTWARE,
INTERPRETER AND COMPILER. A Common example of
programming language use is C.
• NOTE: SP falls under imperative programming language
paradigm.
22
Programming Language Application Domains…
• WEB-CENTRIC: This programming type involves
developing programs that run on the internet.
Web-centric programming is like a two-edged
sword, as it derives from both OOP and Event-
driven programming paradigm.
• Programming languages used include: JAVA,
VISUAL BASIC, VISUAL BASIC.NET, PHP, HTML,
JAVASCRIPT and C++ etc.
• Web-Centric falls under OOP and Event-Driven
Paradigms
23
PROGRAMMING LANGUAGES AND THEIR INVENTORS 24
ADA: It was invented in 1982 by CHARLES BABBAGE but was
named after a woman called ADA
ALGOL: (Algorithmitic language) It was design by a committee
in 1960.
APL: (A programming language) It was design to handle matrix
calculation and the designer is named KENNETH IVERSON in
the early 1960s.
LISP: (List processing) it was invented in 1960 by JOHN
McCARTHY
TAKE HOME I
• Discuss the following programming languages, stating
their full names (where applicable), date
invented/developed and also the inventor/developer.
• Java
• C
• C++
• C#
• PHP
25
PRE-REQUISITE TO PROGRAMMING 26
PSEUDOCODE
•Pseudocode does the same function as
Algorithm but the language of expression
differs. While in algorithm, more technical
terms are used, raw English-like statements
are used in Pseudocode. While algorithm
expressions are formal that of Pseudocode
sounds informal.
PRE-REQUISITE TO PROGRAMMING 27
PSEUDOCODE - ILLUSTRATION
• Literally, take for instance if you are hungry and
intend ‘executing’ a rice – what are the psudocode
steps/procedures for ensuring this? (varied
depending on how u want to program to flow and
be implemented).
• Design a pseudocode that solves the need to
compute for the scores of ten (10) students in
CSC101, MAT101 and PHY101, computing their
average scores.
PRE-REQUISITE TO PROGRAMMING 28
SOLUTION I
• Clean up / Prepare the utensils for the cooking
• Lit the stove/cooker
• Put water in the pot and place on the cooker
• Wash the rice in a basin and put unto the water-pot
• Depending on the type of rice been cooked, put salt or
any other ingredient.
• Cook to taste
• When done, Stop/End Cooking
PRE-REQUISITE TO PROGRAMMING 29
SOLUTION II
• Get the scores in the 3courses
• Carry out their calculations – their sum
• From there, compute their average
• Continue this steps until there is no more student to input
for
• Output the result
• Stop the process
PRE-REQUISITE TO PROGRAMMING 30
ALGORITHM
• Algorithms are sequence of steps taken in solving
a problem. It involves highlighting intended
action(s) for executing a task.
• In programming context, an algorithm can be
described as a guide to logical coding that yields
the intended implementation.
PRE-REQUISITE TO PROGRAMMING 31
PSEUDOCODE - ILLUSTRATION
• Literally, take for instance if you are hungry and
intend ‘executing’ a rice – what are the
algorithmic steps/procedures for ensuring this?
(varied depending on how u want to program to
flow and be implemented).
• Design an algorithm that solves the need to
compute for the scores of ten (10) students in
CSC101, MAT101 and PHY101, computing their
average scores.
PRE-REQUISITE TO PROGRAMMING 32
SOLUTION I
• Set utensils = Available
• Set stove/cooker ON
• Cooker = Water-Pot + Water
• Water-Pot = Rice
• If Rice requires Salt, Then Insert
• Else Put/Insert other Ingredients
• Set Cooking = Max Level/Time
• If Cooking = ‘DONE’ Then STOP/END Cooking
• Else CONTINUE Cooking
PRE-REQUISITE TO PROGRAMMING 33
SOLUTION II
• Enter/Input Value for CSC101, MAT101 and PHY101 scores
• Set Sum = CSC101 + MAT101 + PHY101
• Set Average = Sum/3
• Loop Until Student>10
• Output to the screen
• Stop
Converting Pseudocode/Algorithm to Program Solution 34
SOLUTION II – using QBasic
5 CLS
10 REM
12 LET N = 0
15 INPUT “Enter Value for CSC101”, csc
20 INPUT “Enter Value for MAT101”, mat
25 INPUT “Enter Value for PHY101”, phy
30 LET SUM = csc+mat+phy
35 LET AVG = SUM/3
40 PRINT “The sum of the 3courses is: ” SUM
45 PRINT “The average of the 3courses is: ” AVG
46 N = N + 1
47 IF N<=10 GOTO 15
50 END
TAKE HOME II 35
(1) Write a Pseudocode and Algorithm to solve:
x2 + y3 – (z * w/2)
(2) Write a Pseudocode and Algorithm to compute a candidate’s age
given the birthyear and specifying the current year.
(3) Write a Pseudocode and Algorithm to accepts the UTME and
PUTME scores of candidates, screen out and compute as appropriate
where:
(i) UTME must be >=180
(ii) PUTME must be >=40
(4) Convert 1, 2 and 3 to programming solution using QBasic.
SUBMISSION MODE
•Mailto:
• ajayiprogrammer@gmail.com
• ajayicomputer@gmail.com
36

More Related Content

What's hot

The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life CycleRussell Ovans
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notesVIKAS SINGH BHADOURIA
 
Programming languages
Programming languagesProgramming languages
Programming languagesMuntasirMuhit
 
Logical programming languages and functional programming languages
Logical programming languages and functional programming languagesLogical programming languages and functional programming languages
Logical programming languages and functional programming languagesnahianzarif
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenationAshwini Awatare
 
Introduction to course
Introduction to courseIntroduction to course
Introduction to coursenikit meshram
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing LanguagesMatthew McCullough
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Akshay Nagpurkar
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesAdan Hubahib
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Krishna Sai
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to ProgrammingChaffey College
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)guest251d9a
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programmingKak Yong
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan pptgeorge1616
 

What's hot (20)

The Programmer Life Cycle
The Programmer Life CycleThe Programmer Life Cycle
The Programmer Life Cycle
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Logical programming languages and functional programming languages
Logical programming languages and functional programming languagesLogical programming languages and functional programming languages
Logical programming languages and functional programming languages
 
Unit 2
Unit 2Unit 2
Unit 2
 
Programming language design and implemenation
Programming language design and implemenationProgramming language design and implemenation
Programming language design and implemenation
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
 
Introduction to course
Introduction to courseIntroduction to course
Introduction to course
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing Languages
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
4. processor
4. processor4. processor
4. processor
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming Languages
 
Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-Principles of-programming-languages-lecture-notes-
Principles of-programming-languages-lecture-notes-
 
Comp102 lec 1
Comp102   lec 1Comp102   lec 1
Comp102 lec 1
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
 
La5 ict-topic-5-programming
La5 ict-topic-5-programmingLa5 ict-topic-5-programming
La5 ict-topic-5-programming
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan ppt
 

Similar to DMA113 Chap1

Similar to DMA113 Chap1 (20)

Presentation-1.pptx
Presentation-1.pptxPresentation-1.pptx
Presentation-1.pptx
 
Mcs lec2
Mcs lec2Mcs lec2
Mcs lec2
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Python-unit -I.pptx
Python-unit -I.pptxPython-unit -I.pptx
Python-unit -I.pptx
 
Ic lecture8
Ic lecture8 Ic lecture8
Ic lecture8
 
Chap1
Chap1Chap1
Chap1
 
Logic Formulation 1
Logic Formulation 1Logic Formulation 1
Logic Formulation 1
 
Ppl 13 july2019
Ppl 13 july2019Ppl 13 july2019
Ppl 13 july2019
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Plc part 1
Plc part 1Plc part 1
Plc part 1
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdf
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
LESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm dfLESSON__1-15 C-PROGRAMMING.p algorithm df
LESSON__1-15 C-PROGRAMMING.p algorithm df
 
APP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptxAPP_All Five Unit PPT_NOTES.pptx
APP_All Five Unit PPT_NOTES.pptx
 
Nota (first)
Nota (first)Nota (first)
Nota (first)
 
Unit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptxUnit 1_Evaluation Criteria_session 3.pptx
Unit 1_Evaluation Criteria_session 3.pptx
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow charts
 

More from Bro Shola Ajayi

More from Bro Shola Ajayi (14)

DMA Chap2
DMA Chap2DMA Chap2
DMA Chap2
 
STRUCTURED PROGRAMMING Chap2
STRUCTURED PROGRAMMING Chap2STRUCTURED PROGRAMMING Chap2
STRUCTURED PROGRAMMING Chap2
 
CSC431_Chap1
CSC431_Chap1CSC431_Chap1
CSC431_Chap1
 
Csc413 chap1
Csc413 chap1Csc413 chap1
Csc413 chap1
 
Csc303 part1 chap1
Csc303 part1 chap1Csc303 part1 chap1
Csc303 part1 chap1
 
INTRO TO SQL
INTRO TO SQLINTRO TO SQL
INTRO TO SQL
 
Intro to Web Prog
Intro to Web ProgIntro to Web Prog
Intro to Web Prog
 
Database: An Intro
Database: An IntroDatabase: An Intro
Database: An Intro
 
Database: An Introduction
Database: An IntroductionDatabase: An Introduction
Database: An Introduction
 
Seminar on cgpa calculation
Seminar on cgpa calculationSeminar on cgpa calculation
Seminar on cgpa calculation
 
CSC426 - SDLC Models
CSC426 - SDLC ModelsCSC426 - SDLC Models
CSC426 - SDLC Models
 
CSC426 - Software Engineering Lecture Note Cont'd
CSC426   - Software Engineering Lecture Note Cont'dCSC426   - Software Engineering Lecture Note Cont'd
CSC426 - Software Engineering Lecture Note Cont'd
 
CSC426 - Software Engineering Lecture Note
CSC426   - Software Engineering Lecture NoteCSC426   - Software Engineering Lecture Note
CSC426 - Software Engineering Lecture Note
 
Requirement analysis
Requirement analysisRequirement analysis
Requirement analysis
 

Recently uploaded

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Recently uploaded (20)

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

DMA113 Chap1

  • 1. PRINCIPLE & TECHNIQUES OF PROGRAMMING I AJAYI, O.O. OND, B.Sc., MSc., PhD DMA 113
  • 2. COURSE OUTLINE PART I: PROGRAMMING PRINCIPLE • CHAPTER 1: PROGRAMMING CONCEPTS • CHAPTER 2: PROGRAMMING STYLES PART II: PROGRAMMING TECHNIQUES IN PYTHON • CHAPTER 1: PROGRAMMING ENVIRONMENT • Variables, Data Types, Statements, Assignment etc. • CHAPTER 2: CONTROL STRUCTURE IN PYTHON • CHAPTER 3: ARRAY & LIST PROGRAMMING IN PYTHON • CHAPTER 4: MODULAR PROGRAMMING IN PYTHON 2
  • 3. CHAPTER ONE: PROGRAMMING CONCEPTS 1.1 Programming 1.2 Programming Languages 1.3 Programming Paradigms 1.4 Programming Languages Application Domains 1.5 Programming Languages and their Inventors 1.6 Prerequisite to Programming 3
  • 4. 1.1 Programming & Programming Languages • Programming can be viewed as an act of coding solution for a problem. • It can also be defined as an act of giving instruction to the computer to carry out a task. • It simply implies the ability of a programmer to communicate with the computer system in a particular programming language. • It is a transformational act that brings about changes in the status of task – e.g. manual task to computational one. 4 What is Programming?
  • 5. - Related Concepts to Programming • PROGRAM: This implies the written instruction, which the computer takes in and act upon. It has the synonyms CODE. • PROGRAMMER: This is a person that indulges in coding for solutions. He is regarded as an expert in writing computer codes. His major responsible is to write programs that performs a given or specified function. 5
  • 6. Programming Languages •These indicate the language of choice for which the programmer communicates with the computer machine. •In other words, programming language refers to the language with which a programmer codes. 6
  • 7. Programming Languages - Types •We have 3 types: • Machine Language • Low-Level Language • High Level Language 7
  • 8. Programming Languages – Types cont’d •Machine Language (ML) • This refers to the language which the computer understands. It is a language in which all codes/instructions are represented in the form of 0s and 1s. 8
  • 9. Programming Languages – Types cont’d •Low-Level Language (LLL) •This language is very much close to machine language. It needs little translator to real machine language. It is regarded as SYMBOLIC Language. A good and common example is the ASSEMBLY Language. 9
  • 10. Programming Languages – Types cont’d •High-Level Language (HLL) • This is a language that is close to normal human English Language. It isn’t a languages the computer understands, rather it needs the help of an interpreter or a compiler before computer could understand it. Examples here includes QBasic (Quick – Beginners’ All Purpose Symbolic and Instruction Code), Fortran (FORmulaTRANslator), Pascal (Delphi), Java, C, C++, C#, Python, Ada, Eiffel, PHP (Hypertext 10
  • 11. Programming Paradigms • Programming Paradigms imply trend & evolution of programming languages. • Early Program Development => Machine Language • 1st Program Developed => Assembly Language • Real Program Developed => Fortran (1954) John Backus & IBM Team. • Subsequent Breakthru => Algol60 (1960) 11
  • 12. Programming Paradigms Cont’d… • IMPERATIVE PROGRAMMING This is the type of programming that deals with scientific computation i.e. Its found useful in handling mathematical computation. In this programming language, assignment, sequence and control statement are very important. Examples of this programming paradigm are: FORTRAN, COBOL ,C / C++ and PASCAL 12
  • 13. Programming Paradigms Cont’d… • OBJECT ORIENTED PROGRAMMING (OOP) • This is a type of programming in which object interact by sending messages that change their state. In this programming type, inheritance, polymorphism and object modeling are essential element. • Examples of programming languages in this paradigm include: C++, JAVA, SMALLTALK, EIFFEL, PHP & VISUAL BASIC.NET 13
  • 14. Programming Paradigms Cont’d… • FUNCTIONAL PROGRAMMING • This programming paradigms deals with mathematical functions in which the domain serves as the input and the range serves as the output. • Example of this programming paradigm includes: LISP, SCHEME, HASKEL, MIRANDA, MAPLE, MATHEMATICA and MATLAB. 14
  • 15. Programming Paradigms Cont’d… • LOGIC / DECLARATIVE PROGRAMMING • This programming paradigms deal with collection of logical declaration about what outcome a function should accomplish. • Example of this paradigm includes: PROLOG, SEQUEL, SQL and RPG 15
  • 16. Programming Paradigms Cont’d… • EVENT-DRIVEN PROGRAMMING • This programming paradigms deals with design of program that respond to unpredictable events. • This event are normally generated from users’ actions e.g. mouse click, key press. • Example of this paradigm includes: VISUAL BASIC, VISUAL BASIC.NET, VISUAL C++, VISUAL C#, & JAVA 16
  • 17. Programming Paradigms Cont’d… • CONCURRENT PROGRAMMING • This programming paradigm deals with collection of cooperating process by sharing resources (information) but operating asynchronously. • Example of programming languages in this group include: LINDA, CONCURRENT PASCAL (DELPHI), HIGH PERFORMANCE FORTRAN and JAVA 17
  • 18. Programming Language Application Domains • These include: i. Scientific Programming (SP) ii. Management information system (MIS) iii. Artificial Intelligence (AI) iv. System Programming (SP) v. Web-centric Programming (WP) 18
  • 19. Programming Language Application Domains… • SCIENTIFIC PROGRAMMING: This is programming language that is used for handling complex computations. They are also very useful for teaching and learning. Example of this programming language includes: FORTRAN, COBOL, PASCAL, C and BASIC • NOTE: Scientific programming falls under imperative programming paradigm 19
  • 20. Programming Language Application Domains… • MANAGEMENT INFORMATION SYSTEM: This are program that are used for handling organization information system e.g. payroll system, accounting system, inventory system, online sale and marketing system. Example of this programming language includes: SQL, COBOL and RPG. • NOTE: MIS falls under logic / declarative programming paradigm 20
  • 21. Programming Language Application Domains… • ARTIFICIAL INTELLIGENCE: This are programming types that are used to develop software that model after human intelligent behavior e.g. robot. Example of this programming language includes: LISP, PROLOG, MATLAB and SCHEME. • NOTE: AI falls under programming language paradigm of functional and logic programming language. 21
  • 22. Programming Language Application Domains… • SYSTEM PROGRAMMING: This is a programming type which assist in the design and development of software on which other software runs i.e. system programming deals with developing software that act as platform on which other programs runs. • Examples are OS SOFTWARE, NETWORK SOFTWARE, INTERPRETER AND COMPILER. A Common example of programming language use is C. • NOTE: SP falls under imperative programming language paradigm. 22
  • 23. Programming Language Application Domains… • WEB-CENTRIC: This programming type involves developing programs that run on the internet. Web-centric programming is like a two-edged sword, as it derives from both OOP and Event- driven programming paradigm. • Programming languages used include: JAVA, VISUAL BASIC, VISUAL BASIC.NET, PHP, HTML, JAVASCRIPT and C++ etc. • Web-Centric falls under OOP and Event-Driven Paradigms 23
  • 24. PROGRAMMING LANGUAGES AND THEIR INVENTORS 24 ADA: It was invented in 1982 by CHARLES BABBAGE but was named after a woman called ADA ALGOL: (Algorithmitic language) It was design by a committee in 1960. APL: (A programming language) It was design to handle matrix calculation and the designer is named KENNETH IVERSON in the early 1960s. LISP: (List processing) it was invented in 1960 by JOHN McCARTHY
  • 25. TAKE HOME I • Discuss the following programming languages, stating their full names (where applicable), date invented/developed and also the inventor/developer. • Java • C • C++ • C# • PHP 25
  • 26. PRE-REQUISITE TO PROGRAMMING 26 PSEUDOCODE •Pseudocode does the same function as Algorithm but the language of expression differs. While in algorithm, more technical terms are used, raw English-like statements are used in Pseudocode. While algorithm expressions are formal that of Pseudocode sounds informal.
  • 27. PRE-REQUISITE TO PROGRAMMING 27 PSEUDOCODE - ILLUSTRATION • Literally, take for instance if you are hungry and intend ‘executing’ a rice – what are the psudocode steps/procedures for ensuring this? (varied depending on how u want to program to flow and be implemented). • Design a pseudocode that solves the need to compute for the scores of ten (10) students in CSC101, MAT101 and PHY101, computing their average scores.
  • 28. PRE-REQUISITE TO PROGRAMMING 28 SOLUTION I • Clean up / Prepare the utensils for the cooking • Lit the stove/cooker • Put water in the pot and place on the cooker • Wash the rice in a basin and put unto the water-pot • Depending on the type of rice been cooked, put salt or any other ingredient. • Cook to taste • When done, Stop/End Cooking
  • 29. PRE-REQUISITE TO PROGRAMMING 29 SOLUTION II • Get the scores in the 3courses • Carry out their calculations – their sum • From there, compute their average • Continue this steps until there is no more student to input for • Output the result • Stop the process
  • 30. PRE-REQUISITE TO PROGRAMMING 30 ALGORITHM • Algorithms are sequence of steps taken in solving a problem. It involves highlighting intended action(s) for executing a task. • In programming context, an algorithm can be described as a guide to logical coding that yields the intended implementation.
  • 31. PRE-REQUISITE TO PROGRAMMING 31 PSEUDOCODE - ILLUSTRATION • Literally, take for instance if you are hungry and intend ‘executing’ a rice – what are the algorithmic steps/procedures for ensuring this? (varied depending on how u want to program to flow and be implemented). • Design an algorithm that solves the need to compute for the scores of ten (10) students in CSC101, MAT101 and PHY101, computing their average scores.
  • 32. PRE-REQUISITE TO PROGRAMMING 32 SOLUTION I • Set utensils = Available • Set stove/cooker ON • Cooker = Water-Pot + Water • Water-Pot = Rice • If Rice requires Salt, Then Insert • Else Put/Insert other Ingredients • Set Cooking = Max Level/Time • If Cooking = ‘DONE’ Then STOP/END Cooking • Else CONTINUE Cooking
  • 33. PRE-REQUISITE TO PROGRAMMING 33 SOLUTION II • Enter/Input Value for CSC101, MAT101 and PHY101 scores • Set Sum = CSC101 + MAT101 + PHY101 • Set Average = Sum/3 • Loop Until Student>10 • Output to the screen • Stop
  • 34. Converting Pseudocode/Algorithm to Program Solution 34 SOLUTION II – using QBasic 5 CLS 10 REM 12 LET N = 0 15 INPUT “Enter Value for CSC101”, csc 20 INPUT “Enter Value for MAT101”, mat 25 INPUT “Enter Value for PHY101”, phy 30 LET SUM = csc+mat+phy 35 LET AVG = SUM/3 40 PRINT “The sum of the 3courses is: ” SUM 45 PRINT “The average of the 3courses is: ” AVG 46 N = N + 1 47 IF N<=10 GOTO 15 50 END
  • 35. TAKE HOME II 35 (1) Write a Pseudocode and Algorithm to solve: x2 + y3 – (z * w/2) (2) Write a Pseudocode and Algorithm to compute a candidate’s age given the birthyear and specifying the current year. (3) Write a Pseudocode and Algorithm to accepts the UTME and PUTME scores of candidates, screen out and compute as appropriate where: (i) UTME must be >=180 (ii) PUTME must be >=40 (4) Convert 1, 2 and 3 to programming solution using QBasic.