SlideShare a Scribd company logo
1 of 21
A First Book of C++
Chapter 1(Pt 2)
Programming Design
&
Paradigm
A First Book of C++
Programming Design
 Step 1 - Analyze the problem
 Outline the problem and its requirements
 Design steps (algorithm) to solve the problem
 Step 2 - Implement the algorithm
 Implement the algorithm in code
 Verify that the algorithm works
 Step 3 - Maintenance
 Use and modify the program if the problem domain
changes
Problem Solving Process
(revisit)
C++ Programming: From Problem Analysis to Program
Design, Third Edition
3
 Thoroughly understand the problem
 Understand problem requirements
 Does program require user interaction?
 Does program manipulate data?
 What is the output?
 If the problem is complex, divide it into sub-
problems
 Analyze each sub-problem as above
Analyze the Problem
C++ Programming: From Problem Analysis to Program
Design, Third Edition
5
 If problem was broken into sub-problems
 Design algorithms for each sub-problem
 Check the correctness of algorithm
 Can test using sample data
 Some mathematical analysis might be required
Design an Algorithm
C++ Programming: From Problem Analysis to Program
Design, Third Edition
6
 Once the algorithm is designed and correctness
verified
 Write the equivalent code in high-level language
 Type the program using text editor
Write the Code
C++ Programming: From Problem Analysis to Program
Design, Third Edition
7
 Run code through compiler
 If compiler generates errors
 Look at code and remove errors
 Run code again through compiler
 If there are no syntax errors
 Compiler generates equivalent machine code
 Linker links machine code with system resources
Compiling and Linking
C++ Programming: From Problem Analysis to Program
Design, Third Edition
8
 Once compiled and linked, loader can place
program into main memory for execution
 The final step is to execute the program
 Compiler guarantees that the program follows the
rules of the language
 Does not guarantee that the program will run
correctly
The Loader and Executing
C++ Programming: From Problem Analysis to Program
Design, Third Edition
9
A First Book of C++
Programming Paradigm
Definition:
A way of conceptualizing what it means to
perform computation and how tasks to be carried
out on the computer should be structured and
organized.
Programming Paradigm
A First Book of C++ 4th Edition 11
 General types of programming paradigms:
 Structural
 Imperative
 Declarative
 Procedural
 Object-Oriented
 Functional
 Domain-Specific
Programming Paradigm
(cont'd.)
A First Book of C++ 4th Edition 12
 Structured programming (or modular
programming) is a problem solving strategy
and a programming methodology that
includes the following guidelines:
 The flow of control in the program should be as
simple as possible.
 The construction of a program should embody
top-down design.
Programming Paradigm
(cont'd.)
A First Book of C++ 4th Edition 13
 Top-down design means:
 It repeatedly decomposing a problem into
smaller problems.
 Eventually leads to:
 a collection of small problems or tasks.
 each can be easily coded
Programming Paradigm
(cont'd.)
A First Book of C++ 4th Edition 14
 Object-oriented programming is a method of
programming based on a hierarchy of classes, and
well-defined and cooperating objects.
 A class is a structure that defines the data and the
methods to work on that data.
 In simple definition, a class is a programmer defined
data type.
Programming Paradigm
(cont'd.)
A First Book of C++ 4th Edition 15
 Object-oriented programming (OOP) concepts are:
Programming Paradigm
(cont'd.)
A First Book of C++ 4th Edition 16
Concepts Functions
Data Abstraction specifies behavior
Encapsulation controls visibility of names (data
hiding)
Polymorphism accommodates various
implementations
Inheritance facilitates code reuse
Modularity relates to unit of compilation
Structured vs. Object-Oriented
Programming
A First Book of C++ 4th Edition 17
Structured Programming:
MAIN PROGRAM
FUNCTION 3FUNCTION 2
GLOBAL DATA
FUNCTION 5FUNCTION 4
FUNCTION
1
Structured Programming:
 Using functions.
 Function & program is divided into modules.
 Every module has its own data and function which
can be called by other modules.
Structured vs. Object-Oriented
Programming
A First Book of C++ 4th Edition 18
Structured vs. Object-Oriented
Programming (cont'd.)
A First Book of C++ 4th Edition 19
Object-Oriented Programming:
Object 1
Object 2
Data
Function
Data
Function
Object 3
Data
Function
Object-Oriented Programming:
 Objects have both data and methods.
 Objects of the same class have the same data
elements and methods.
 Objects send and receive messages to invoke
actions.
Structured vs. Object-Oriented
Programming
A First Book of C++ 4th Edition 20
 Data object
 Set of values packaged as single unit (e.g., student’s
name & grade)
 Class
 Set of objects with similar attributes
 General concept of object-oriented programming is the
difference between an object and the larger set of which
it is a member (class)
 A red Ford is an instance, or object, of a general class
of automobiles or cars
Classes and Objects
A First Book of C++ 4th Edition 21

More Related Content

What's hot

Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programingAhammed Alamin
 
9781285852744 ppt ch02
9781285852744 ppt ch029781285852744 ppt ch02
9781285852744 ppt ch02Terry Yoast
 
Code: from Procedural to Object Oriented
Code: from Procedural to Object OrientedCode: from Procedural to Object Oriented
Code: from Procedural to Object Orientedkleinron
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' programSahithi Naraparaju
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Project 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletProject 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletMessanz
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
9781285852744 ppt ch12
9781285852744 ppt ch129781285852744 ppt ch12
9781285852744 ppt ch12Terry Yoast
 
The process of programming
 The process of programming The process of programming
The process of programmingKopi Maheswaran
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsPrabu U
 
Functions ppt ch06
Functions ppt ch06Functions ppt ch06
Functions ppt ch06Terry Yoast
 
9781285852744 ppt ch10
9781285852744 ppt ch109781285852744 ppt ch10
9781285852744 ppt ch10Terry Yoast
 
Software code metrics
Software code metricsSoftware code metrics
Software code metricsPVS-Studio
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 

What's hot (19)

Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programing
 
9781285852744 ppt ch02
9781285852744 ppt ch029781285852744 ppt ch02
9781285852744 ppt ch02
 
Programming and problem solving with c++, 3rd edition
Programming and problem solving with c++, 3rd editionProgramming and problem solving with c++, 3rd edition
Programming and problem solving with c++, 3rd edition
 
C language
C languageC language
C language
 
Code: from Procedural to Object Oriented
Code: from Procedural to Object OrientedCode: from Procedural to Object Oriented
Code: from Procedural to Object Oriented
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' program
 
Chap 02-1
Chap 02-1Chap 02-1
Chap 02-1
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Project 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutletProject 2 the second project involves/tutorialoutlet
Project 2 the second project involves/tutorialoutlet
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Week10 final
Week10 finalWeek10 final
Week10 final
 
9781285852744 ppt ch12
9781285852744 ppt ch129781285852744 ppt ch12
9781285852744 ppt ch12
 
C language
C languageC language
C language
 
The process of programming
 The process of programming The process of programming
The process of programming
 
Decision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, StringsDecision Making Statements, Arrays, Strings
Decision Making Statements, Arrays, Strings
 
Functions ppt ch06
Functions ppt ch06Functions ppt ch06
Functions ppt ch06
 
9781285852744 ppt ch10
9781285852744 ppt ch109781285852744 ppt ch10
9781285852744 ppt ch10
 
Software code metrics
Software code metricsSoftware code metrics
Software code metrics
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 

Viewers also liked

Introduction fundamentals sets and sequences (notes)
Introduction  fundamentals sets and sequences (notes)Introduction  fundamentals sets and sequences (notes)
Introduction fundamentals sets and sequences (notes)IIUM
 
Museo De Genalguacil
Museo De GenalguacilMuseo De Genalguacil
Museo De Genalguacilbertha reyes
 
SPIRIT AWARD Q4 spirit Magazine
SPIRIT AWARD Q4 spirit MagazineSPIRIT AWARD Q4 spirit Magazine
SPIRIT AWARD Q4 spirit MagazineTegan Marroquin
 
Group project overall
Group project overallGroup project overall
Group project overallIIUM
 
International Market entry strategies: Agency Model
International Market entry strategies: Agency ModelInternational Market entry strategies: Agency Model
International Market entry strategies: Agency ModelPrakaash Govindasamy
 
Uso de comandos insert, update y delete en bases de datos de sql server
Uso de comandos insert, update y delete en bases de datos de sql serverUso de comandos insert, update y delete en bases de datos de sql server
Uso de comandos insert, update y delete en bases de datos de sql serverPedrangas Pedrangas
 
Substituindo o request message no mule
Substituindo o request message no muleSubstituindo o request message no mule
Substituindo o request message no muleJeison Barros
 
Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2IIUM
 
Educational issues in the context of urbanization, globalization and privatiz...
Educational issues in the context of urbanization, globalization and privatiz...Educational issues in the context of urbanization, globalization and privatiz...
Educational issues in the context of urbanization, globalization and privatiz...Hathib KK
 
Hex bolt drawings
Hex bolt drawingsHex bolt drawings
Hex bolt drawingsgirishdn
 
7079581 quantitative-techniques-for-management
7079581 quantitative-techniques-for-management7079581 quantitative-techniques-for-management
7079581 quantitative-techniques-for-managementlakshmi narayana murthy
 

Viewers also liked (14)

Introduction fundamentals sets and sequences (notes)
Introduction  fundamentals sets and sequences (notes)Introduction  fundamentals sets and sequences (notes)
Introduction fundamentals sets and sequences (notes)
 
Museo De Genalguacil
Museo De GenalguacilMuseo De Genalguacil
Museo De Genalguacil
 
SPIRIT AWARD Q4 spirit Magazine
SPIRIT AWARD Q4 spirit MagazineSPIRIT AWARD Q4 spirit Magazine
SPIRIT AWARD Q4 spirit Magazine
 
Group project overall
Group project overallGroup project overall
Group project overall
 
International Market entry strategies: Agency Model
International Market entry strategies: Agency ModelInternational Market entry strategies: Agency Model
International Market entry strategies: Agency Model
 
Uso de comandos insert, update y delete en bases de datos de sql server
Uso de comandos insert, update y delete en bases de datos de sql serverUso de comandos insert, update y delete en bases de datos de sql server
Uso de comandos insert, update y delete en bases de datos de sql server
 
Substituindo o request message no mule
Substituindo o request message no muleSubstituindo o request message no mule
Substituindo o request message no mule
 
Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2Csc1100 lecture12 ch08_pt2
Csc1100 lecture12 ch08_pt2
 
Educational issues in the context of urbanization, globalization and privatiz...
Educational issues in the context of urbanization, globalization and privatiz...Educational issues in the context of urbanization, globalization and privatiz...
Educational issues in the context of urbanization, globalization and privatiz...
 
Hex bolt drawings
Hex bolt drawingsHex bolt drawings
Hex bolt drawings
 
Aprendizaje in 2
Aprendizaje in 2Aprendizaje in 2
Aprendizaje in 2
 
Aprendizaje invisible 2
Aprendizaje invisible 2Aprendizaje invisible 2
Aprendizaje invisible 2
 
7079581 quantitative-techniques-for-management
7079581 quantitative-techniques-for-management7079581 quantitative-techniques-for-management
7079581 quantitative-techniques-for-management
 
Operaciones Básicas en PHP
Operaciones Básicas en PHPOperaciones Básicas en PHP
Operaciones Básicas en PHP
 

Similar to Csc1100 lecture01 ch01 pt2-paradigm (1)

C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit orderMalikireddy Bramhananda Reddy
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++Seble Nigussie
 
Book management system
Book management systemBook management system
Book management systemSHARDA SHARAN
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEMMansi Tyagi
 
ch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesLiemLe21
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
C++ Programming Chapter 01
C++ Programming Chapter 01C++ Programming Chapter 01
C++ Programming Chapter 01Sourng Seng
 
Overview of c++
Overview of c++Overview of c++
Overview of c++geeeeeet
 
Chapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfChapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfKirubelWondwoson1
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN BASHA
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxSanketShah544615
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptxshoaibkhan716300
 
Computer Programming
Computer ProgrammingComputer Programming
Computer ProgrammingBurhan Fakhar
 
program development and paradigms
program development and paradigmsprogram development and paradigms
program development and paradigmskasenerd
 

Similar to Csc1100 lecture01 ch01 pt2-paradigm (1) (20)

C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
C AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDYC AND DATASTRUCTURES PREPARED BY M V B REDDY
C AND DATASTRUCTURES PREPARED BY M V B REDDY
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Book management system
Book management systemBook management system
Book management system
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEM
 
ch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesch01_an overview of computers and programming languages
ch01_an overview of computers and programming languages
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
C++ ch1
C++ ch1C++ ch1
C++ ch1
 
C++ Programming Chapter 01
C++ Programming Chapter 01C++ Programming Chapter 01
C++ Programming Chapter 01
 
Overview of c++
Overview of c++Overview of c++
Overview of c++
 
C tutorials
C tutorialsC tutorials
C tutorials
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
Chapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfChapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdf
 
SULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notesSULTHAN's - C Programming Language notes
SULTHAN's - C Programming Language notes
 
Se
SeSe
Se
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
program development and paradigms
program development and paradigmsprogram development and paradigms
program development and paradigms
 

More from IIUM

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhostIIUM
 
Chapter 2
Chapter 2Chapter 2
Chapter 2IIUM
 
Chapter 1
Chapter 1Chapter 1
Chapter 1IIUM
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimediaIIUM
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblockIIUM
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice keyIIUM
 
Group p1
Group p1Group p1
Group p1IIUM
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoIIUM
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009IIUM
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lformsIIUM
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answerIIUM
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
Heaps
HeapsHeaps
HeapsIIUM
 
Report format
Report formatReport format
Report formatIIUM
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelinesIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516IIUM
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotationsIIUM
 
Week12 graph
Week12   graph Week12   graph
Week12 graph IIUM
 

More from IIUM (20)

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhost
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimedia
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblock
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice key
 
Group p1
Group p1Group p1
Group p1
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seo
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answer
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Heaps
HeapsHeaps
Heaps
 
Report format
Report formatReport format
Report format
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelines
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotations
 
Week12 graph
Week12   graph Week12   graph
Week12 graph
 

Csc1100 lecture01 ch01 pt2-paradigm (1)

  • 1. A First Book of C++ Chapter 1(Pt 2) Programming Design & Paradigm
  • 2. A First Book of C++ Programming Design
  • 3.  Step 1 - Analyze the problem  Outline the problem and its requirements  Design steps (algorithm) to solve the problem  Step 2 - Implement the algorithm  Implement the algorithm in code  Verify that the algorithm works  Step 3 - Maintenance  Use and modify the program if the problem domain changes Problem Solving Process (revisit) C++ Programming: From Problem Analysis to Program Design, Third Edition 3
  • 4.
  • 5.  Thoroughly understand the problem  Understand problem requirements  Does program require user interaction?  Does program manipulate data?  What is the output?  If the problem is complex, divide it into sub- problems  Analyze each sub-problem as above Analyze the Problem C++ Programming: From Problem Analysis to Program Design, Third Edition 5
  • 6.  If problem was broken into sub-problems  Design algorithms for each sub-problem  Check the correctness of algorithm  Can test using sample data  Some mathematical analysis might be required Design an Algorithm C++ Programming: From Problem Analysis to Program Design, Third Edition 6
  • 7.  Once the algorithm is designed and correctness verified  Write the equivalent code in high-level language  Type the program using text editor Write the Code C++ Programming: From Problem Analysis to Program Design, Third Edition 7
  • 8.  Run code through compiler  If compiler generates errors  Look at code and remove errors  Run code again through compiler  If there are no syntax errors  Compiler generates equivalent machine code  Linker links machine code with system resources Compiling and Linking C++ Programming: From Problem Analysis to Program Design, Third Edition 8
  • 9.  Once compiled and linked, loader can place program into main memory for execution  The final step is to execute the program  Compiler guarantees that the program follows the rules of the language  Does not guarantee that the program will run correctly The Loader and Executing C++ Programming: From Problem Analysis to Program Design, Third Edition 9
  • 10. A First Book of C++ Programming Paradigm
  • 11. Definition: A way of conceptualizing what it means to perform computation and how tasks to be carried out on the computer should be structured and organized. Programming Paradigm A First Book of C++ 4th Edition 11
  • 12.  General types of programming paradigms:  Structural  Imperative  Declarative  Procedural  Object-Oriented  Functional  Domain-Specific Programming Paradigm (cont'd.) A First Book of C++ 4th Edition 12
  • 13.  Structured programming (or modular programming) is a problem solving strategy and a programming methodology that includes the following guidelines:  The flow of control in the program should be as simple as possible.  The construction of a program should embody top-down design. Programming Paradigm (cont'd.) A First Book of C++ 4th Edition 13
  • 14.  Top-down design means:  It repeatedly decomposing a problem into smaller problems.  Eventually leads to:  a collection of small problems or tasks.  each can be easily coded Programming Paradigm (cont'd.) A First Book of C++ 4th Edition 14
  • 15.  Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.  A class is a structure that defines the data and the methods to work on that data.  In simple definition, a class is a programmer defined data type. Programming Paradigm (cont'd.) A First Book of C++ 4th Edition 15
  • 16.  Object-oriented programming (OOP) concepts are: Programming Paradigm (cont'd.) A First Book of C++ 4th Edition 16 Concepts Functions Data Abstraction specifies behavior Encapsulation controls visibility of names (data hiding) Polymorphism accommodates various implementations Inheritance facilitates code reuse Modularity relates to unit of compilation
  • 17. Structured vs. Object-Oriented Programming A First Book of C++ 4th Edition 17 Structured Programming: MAIN PROGRAM FUNCTION 3FUNCTION 2 GLOBAL DATA FUNCTION 5FUNCTION 4 FUNCTION 1
  • 18. Structured Programming:  Using functions.  Function & program is divided into modules.  Every module has its own data and function which can be called by other modules. Structured vs. Object-Oriented Programming A First Book of C++ 4th Edition 18
  • 19. Structured vs. Object-Oriented Programming (cont'd.) A First Book of C++ 4th Edition 19 Object-Oriented Programming: Object 1 Object 2 Data Function Data Function Object 3 Data Function
  • 20. Object-Oriented Programming:  Objects have both data and methods.  Objects of the same class have the same data elements and methods.  Objects send and receive messages to invoke actions. Structured vs. Object-Oriented Programming A First Book of C++ 4th Edition 20
  • 21.  Data object  Set of values packaged as single unit (e.g., student’s name & grade)  Class  Set of objects with similar attributes  General concept of object-oriented programming is the difference between an object and the larger set of which it is a member (class)  A red Ford is an instance, or object, of a general class of automobiles or cars Classes and Objects A First Book of C++ 4th Edition 21