SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Revision
Michael Heron
Introduction
• In today’s lecture we are going to round off our discussion of
programming with a revision of topics.
• The theoretical side of these at least.
• This relates to the examination portion of the module.
• Important to understand the concepts for this.
• Code of secondary importance.
What Is A Program?
• A program is a series of statements to the computer.
• Computers are stupid
• Humans are clever
• Need to ‘talk down’ to the computer
• Process of arriving at a working program very complicated.
• Involves the interaction of many skills.
Representing Information
• Information in a computer program is represented by
variables.
• These are stored in the computer’s memory.
• Variables stand in place of literal values.
• We don’t know what they will be when we run the program.
• Used to deal with ambiguity.
• Can be many different types.
Flow of Execution
• All programs have a flow of execution.
• This determines in what order the code statements are executed.
• By default, flow of execution is sequential.
• Statements are executed one after the other.
• We have access to many flow control operations to change
that.
• These permit us to change the order in which code is executed.
Flow of Execution
• Repetition structures are used to repeat sections of code.
• They fall into two categories.
• Unbounded loops, when we don’t know how many times to
iterate.
• Bounded loops, when we do.
• For loops are bounded loops.
• While loops are unbounded loops.
• Also exist a do-while loop, with more situational use.
Flow of Execution
• Selection structures allow us to choose between different
paths of execution.
• If lets us provide code that might be executed if conditions are
met.
• If-else lets us provide between two mutually exclusive course of
action.
• If-Else if allows for more fine-grained control.
• Switch statement exists as a syntactic nicety.
• It makes code more readable.
Arrays
• Representing data as single variables very limited.
• Many real world situations require something more
comprehensive.
• Arrays exist as a collection of related data.
• A list of names, a list of ages, etc
• Arrays are syntatically amenable to manipulation with other
structures.
• For loops in particular.
Arrays
• Arrays serve as the basis for more complicated data
structures.
• They can be 1D, 2D, or as many dimensions as we like.
• Arrays are made up of elements which are identified by
indices.
• The number of indices is dependant on how many dimensions
the array has.
• It’s like a variable with many different compartments.
Functions
• Incorporating all program code into a single main function is
very limited.
• Hard to write
• Hard to read
• Hard to maintain
• Functions allow us to split up the functionality between
smaller units.
• Functions, or methods
• Same thing with different names.
Functions
• Functions are uniquely identified by their signatures.
• Their name, and the order and type of their parameters.
• Parameters get sent into functions as a way of providing
information.
• Functions can return a value to their calling function.
• To give information back.
Functions and Variables
• Functions introduce a new issue with regards to variables.
• That of Scope
• In a program, variables have one of three kinds of scope.
• Local
• Global
• Class-wide
Pointers
• Variables represent an abstraction.
• They are not the memory addresses, but the contents of the
memory addresses.
• Pointers allow us to access memory locations directly.
• Useful for several reasons.
• Works through the use of two operators
• *, which is the dereference operator
• &, which is the reference operator.
Program Correctness
• Most programs are not very correct.
• They crash, or misbehave.
• It’s very hard to create correct computer programs.
• Beyond the ability of Mortal Ken
• This a direct result of the way digital data is represented.
• We can take a structured, systematic approach to this.
• By creating and following a testing strategy
Testing
• Testing breaks down into two key families.
• Black box testing, which tests only inputs and outputs.
• White box testing, which tests only the flow of execution through
the program.
• Testing based on the creation of test cases.
• These stress ‘high risk’ parts of the system.
• A good testing strategy is one designed to uncover flaws.
Debugging
• Getting a program running is the easy thing.
• Getting it working is more difficult.
• Debugging is a complex task requiring patience and a
particular mindset.
• It involves tracking down often complex misbehavior.
• It is a process intricately linked to programming.
• But a separate and distinct step.
Objects
• C++ is an object oriented language.
• This introduces new difficulties in development.
• Object oriented programming is built on two main structures.
• The class, which is a blueprint
• The object, which is a specific instance of a class.
• Classes define our structural side of the program.
• Objects define our dynamic side.
Objects and Classes
• Classes sit idle until we create objects from them.
• This process is called instantiation.
• The class defines the structure.
• The attributes
• The methods
• The object defines the state.
• The value each of the attributes has.
Encapsulation
• Good object design is very difficult.
• It takes years and years of practise and making mistakes.
• Some principles exist to aid in design.
• Encapsulation is the principle of tying data and the methods that act
on that data together.
• We can protect the delicate innards of an object using visibility
modifiers on the data.
• Private, Public, Protected
• The set of public methods exposed defines the object’s interface.
Inheritance
• Inheritance is the technique of allowing one class to
incorporate methods and attributes defined in another.
• The child class inherits the methods and attributes of the parent.
• Useful for many reasons.
• Maintenance
• Reusability
• Cohesion of interface
Object Design
• Hard to assess a particular object hierarchy.
• Some metrics exist
• Cohesion
• Coupling
• Impact of Change
• Important to create objects in the right way.
• Black box design
• Incorporate placeholders
• Compile early and often
File Handling
• Input and Output in C++ is handled via streams for the most
part.
• cout and cin are examples of streams.
• File I/O in C++ is handled as an extension of this idea.
• Create an appropriate object
• Manipulate it using << and >>
• Close it when you’re done
Stream I/O
• Streams in C++ are very versatile.
• They can be manipulated using stream manipulators.
• Techniques are shared between keyboard / monitor I/O and
file I/O
• What works for one will work for the other.
• This is powered by inheritance.
• They all inherit from the same basic structure.
Parsing
• Most of the data you pull into a system will not be in a format
suitable for processing.
• Necessary to parse data into a suitable format.
• Various parsing routines exist.
• Tokenization
• Object representation
• Data conversion
• Usually necessary to ‘roll your own’
• Data representation is too important to leave to ‘off the shelf’
solutions.
Summary
• Summarising a summary of the module is a crazy thing to do
• So instead I will put some jokes.
• Two fish are in a tank. One turns to the other and says ‘Do you
know how to drive this thing?’
• The other says ‘My word! A talking fish!’
• Have you heard about the new pirate movie? It’s rated
AaaaAaaaaAaarrrrRrr!

Weitere ähnliche Inhalte

Was ist angesagt?

Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Jamshid Hashimi
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingObject-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingAllan Mangune
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Asfand Hassan
 
OOP Unit 1 - Foundation of Object- Oriented Programming
OOP Unit 1 - Foundation of Object- Oriented ProgrammingOOP Unit 1 - Foundation of Object- Oriented Programming
OOP Unit 1 - Foundation of Object- Oriented Programmingdkpawar
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programmingSaket Khopkar
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programmingAmar Jukuntla
 
C++ chapter 1
C++ chapter 1C++ chapter 1
C++ chapter 1jasvinder162
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming Rokonuzzaman Rony
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 

Was ist angesagt? (10)

Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & ProgrammingObject-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & Programming
 
UML
UMLUML
UML
 
Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)Oop lec 2(introduction to object oriented technology)
Oop lec 2(introduction to object oriented technology)
 
OOP Unit 1 - Foundation of Object- Oriented Programming
OOP Unit 1 - Foundation of Object- Oriented ProgrammingOOP Unit 1 - Foundation of Object- Oriented Programming
OOP Unit 1 - Foundation of Object- Oriented Programming
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
C++ chapter 1
C++ chapter 1C++ chapter 1
C++ chapter 1
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 

Andere mochten auch

CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramMichael Heron
 
CPP09 - Testing
CPP09 - TestingCPP09 - Testing
CPP09 - TestingMichael Heron
 
CPP04 - Selection
CPP04 - SelectionCPP04 - Selection
CPP04 - SelectionMichael Heron
 
Representation of geometric figuers in Braille
Representation of  geometric figuers in BrailleRepresentation of  geometric figuers in Braille
Representation of geometric figuers in BrailleBIJIT GHOSH
 
CPP08 - Pointers
CPP08 - PointersCPP08 - Pointers
CPP08 - PointersMichael Heron
 
CPP01 - Introduction to C++
CPP01 - Introduction to C++CPP01 - Introduction to C++
CPP01 - Introduction to C++Michael Heron
 
CPP03 - Repetition
CPP03 - RepetitionCPP03 - Repetition
CPP03 - RepetitionMichael Heron
 
CPP10 - Debugging
CPP10 - DebuggingCPP10 - Debugging
CPP10 - DebuggingMichael Heron
 
CPP12 - Algorithms
CPP12 - AlgorithmsCPP12 - Algorithms
CPP12 - AlgorithmsMichael Heron
 
Secure communication in Networking
Secure communication in NetworkingSecure communication in Networking
Secure communication in Networkinganita maharjan
 
CPP05 - Arrays
CPP05 - ArraysCPP05 - Arrays
CPP05 - ArraysMichael Heron
 
CPP06 - Functions
CPP06 - FunctionsCPP06 - Functions
CPP06 - FunctionsMichael Heron
 
CPP11 - Function Design
CPP11 - Function DesignCPP11 - Function Design
CPP11 - Function DesignMichael Heron
 
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and EncapsulationPHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and EncapsulationTushar Sharma
 
Refactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 TutorialRefactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 TutorialTushar Sharma
 
Comparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for RegressionComparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for RegressionSeonho Park
 
Handwritten Character Recognition
Handwritten Character RecognitionHandwritten Character Recognition
Handwritten Character RecognitionConstantine Priemski
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - EncapsulationMichael Heron
 
Does your design smell?
Does your design smell?Does your design smell?
Does your design smell?Tushar Sharma
 

Andere mochten auch (20)

CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a Program
 
CPP09 - Testing
CPP09 - TestingCPP09 - Testing
CPP09 - Testing
 
CPP07 - Scope
CPP07 - ScopeCPP07 - Scope
CPP07 - Scope
 
CPP04 - Selection
CPP04 - SelectionCPP04 - Selection
CPP04 - Selection
 
Representation of geometric figuers in Braille
Representation of  geometric figuers in BrailleRepresentation of  geometric figuers in Braille
Representation of geometric figuers in Braille
 
CPP08 - Pointers
CPP08 - PointersCPP08 - Pointers
CPP08 - Pointers
 
CPP01 - Introduction to C++
CPP01 - Introduction to C++CPP01 - Introduction to C++
CPP01 - Introduction to C++
 
CPP03 - Repetition
CPP03 - RepetitionCPP03 - Repetition
CPP03 - Repetition
 
CPP10 - Debugging
CPP10 - DebuggingCPP10 - Debugging
CPP10 - Debugging
 
CPP12 - Algorithms
CPP12 - AlgorithmsCPP12 - Algorithms
CPP12 - Algorithms
 
Secure communication in Networking
Secure communication in NetworkingSecure communication in Networking
Secure communication in Networking
 
CPP05 - Arrays
CPP05 - ArraysCPP05 - Arrays
CPP05 - Arrays
 
CPP06 - Functions
CPP06 - FunctionsCPP06 - Functions
CPP06 - Functions
 
CPP11 - Function Design
CPP11 - Function DesignCPP11 - Function Design
CPP11 - Function Design
 
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and EncapsulationPHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
 
Refactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 TutorialRefactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 Tutorial
 
Comparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for RegressionComparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for Regression
 
Handwritten Character Recognition
Handwritten Character RecognitionHandwritten Character Recognition
Handwritten Character Recognition
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
Does your design smell?
Does your design smell?Does your design smell?
Does your design smell?
 

Ähnlich wie CPP19 - Revision

Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object DesignMichael Heron
 
2CPP19 - Summation
2CPP19 - Summation2CPP19 - Summation
2CPP19 - SummationMichael Heron
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptxIndraKhatri
 
Algorithms and Data Structures
Algorithms and Data StructuresAlgorithms and Data Structures
Algorithms and Data Structuressonykhan3
 
Software Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxSoftware Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxgauriVarshney8
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfDukeCalvin
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsAkhil Kaushik
 
73d32 session1 c++
73d32 session1 c++73d32 session1 c++
73d32 session1 c++Mukund Trivedi
 
PPL, OQL & oodbms
PPL, OQL & oodbmsPPL, OQL & oodbms
PPL, OQL & oodbmsramandeep brar
 
Programming in the large
Programming in the largeProgramming in the large
Programming in the largeNaveenkumar Muguda
 
OOP -interface and objects.pptx
OOP -interface and objects.pptxOOP -interface and objects.pptx
OOP -interface and objects.pptxEdFeranil
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentationBhavin Gandhi
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dineshDinesh Kumar
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remanijaxconf
 
Introduction to Database Management Systems (DBMS)
Introduction to Database Management Systems (DBMS)Introduction to Database Management Systems (DBMS)
Introduction to Database Management Systems (DBMS)Vijayananda Ratnam Ch
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling SoftwareAbdelmonaim Remani
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method OverloadingMichael Heron
 

Ähnlich wie CPP19 - Revision (20)

Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object Design
 
2CPP19 - Summation
2CPP19 - Summation2CPP19 - Summation
2CPP19 - Summation
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Algorithms and Data Structures
Algorithms and Data StructuresAlgorithms and Data Structures
Algorithms and Data Structures
 
Software Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxSoftware Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptx
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
73d32 session1 c++
73d32 session1 c++73d32 session1 c++
73d32 session1 c++
 
PPL, OQL & oodbms
PPL, OQL & oodbmsPPL, OQL & oodbms
PPL, OQL & oodbms
 
Programming in the large
Programming in the largeProgramming in the large
Programming in the large
 
OOP -interface and objects.pptx
OOP -interface and objects.pptxOOP -interface and objects.pptx
OOP -interface and objects.pptx
 
Scheduling Thread
Scheduling  ThreadScheduling  Thread
Scheduling Thread
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dinesh
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remani
 
Introduction to Database Management Systems (DBMS)
Introduction to Database Management Systems (DBMS)Introduction to Database Management Systems (DBMS)
Introduction to Database Management Systems (DBMS)
 
The Economies of Scaling Software
The Economies of Scaling SoftwareThe Economies of Scaling Software
The Economies of Scaling Software
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
 

Mehr von Michael Heron

Meeple centred design - Board Game Accessibility
Meeple centred design - Board Game AccessibilityMeeple centred design - Board Game Accessibility
Meeple centred design - Board Game AccessibilityMichael Heron
 
Musings on misconduct
Musings on misconductMusings on misconduct
Musings on misconductMichael Heron
 
Accessibility Support with the ACCESS Framework
Accessibility Support with the ACCESS FrameworkAccessibility Support with the ACCESS Framework
Accessibility Support with the ACCESS FrameworkMichael Heron
 
ACCESS: A Technical Framework for Adaptive Accessibility Support
ACCESS:  A Technical Framework for Adaptive Accessibility SupportACCESS:  A Technical Framework for Adaptive Accessibility Support
ACCESS: A Technical Framework for Adaptive Accessibility SupportMichael Heron
 
Authorship and Autership
Authorship and AutershipAuthorship and Autership
Authorship and AutershipMichael Heron
 
Text parser based interaction
Text parser based interactionText parser based interaction
Text parser based interactionMichael Heron
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - InheritanceMichael Heron
 
GRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and RadiosityGRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and RadiosityMichael Heron
 
GRPHICS07 - Textures
GRPHICS07 - TexturesGRPHICS07 - Textures
GRPHICS07 - TexturesMichael Heron
 
GRPHICS06 - Shading
GRPHICS06 - ShadingGRPHICS06 - Shading
GRPHICS06 - ShadingMichael Heron
 
GRPHICS05 - Rendering (2)
GRPHICS05 - Rendering (2)GRPHICS05 - Rendering (2)
GRPHICS05 - Rendering (2)Michael Heron
 
GRPHICS04 - Rendering (1)
GRPHICS04 - Rendering (1)GRPHICS04 - Rendering (1)
GRPHICS04 - Rendering (1)Michael Heron
 
GRPHICS03 - Graphical Representation
GRPHICS03 - Graphical RepresentationGRPHICS03 - Graphical Representation
GRPHICS03 - Graphical RepresentationMichael Heron
 
GRPHICS02 - Creating 3D Graphics
GRPHICS02 - Creating 3D GraphicsGRPHICS02 - Creating 3D Graphics
GRPHICS02 - Creating 3D GraphicsMichael Heron
 
GRPHICS01 - Introduction to 3D Graphics
GRPHICS01 - Introduction to 3D GraphicsGRPHICS01 - Introduction to 3D Graphics
GRPHICS01 - Introduction to 3D GraphicsMichael Heron
 
GRPHICS09 - Art Appreciation
GRPHICS09 - Art AppreciationGRPHICS09 - Art Appreciation
GRPHICS09 - Art AppreciationMichael Heron
 
2CPP18 - Modifiers
2CPP18 - Modifiers2CPP18 - Modifiers
2CPP18 - ModifiersMichael Heron
 
2CPP17 - File IO
2CPP17 - File IO2CPP17 - File IO
2CPP17 - File IOMichael Heron
 
2CPP15 - Templates
2CPP15 - Templates2CPP15 - Templates
2CPP15 - TemplatesMichael Heron
 

Mehr von Michael Heron (20)

Meeple centred design - Board Game Accessibility
Meeple centred design - Board Game AccessibilityMeeple centred design - Board Game Accessibility
Meeple centred design - Board Game Accessibility
 
Musings on misconduct
Musings on misconductMusings on misconduct
Musings on misconduct
 
Accessibility Support with the ACCESS Framework
Accessibility Support with the ACCESS FrameworkAccessibility Support with the ACCESS Framework
Accessibility Support with the ACCESS Framework
 
ACCESS: A Technical Framework for Adaptive Accessibility Support
ACCESS:  A Technical Framework for Adaptive Accessibility SupportACCESS:  A Technical Framework for Adaptive Accessibility Support
ACCESS: A Technical Framework for Adaptive Accessibility Support
 
Authorship and Autership
Authorship and AutershipAuthorship and Autership
Authorship and Autership
 
Text parser based interaction
Text parser based interactionText parser based interaction
Text parser based interaction
 
SAD04 - Inheritance
SAD04 - InheritanceSAD04 - Inheritance
SAD04 - Inheritance
 
GRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and RadiosityGRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and Radiosity
 
GRPHICS07 - Textures
GRPHICS07 - TexturesGRPHICS07 - Textures
GRPHICS07 - Textures
 
GRPHICS06 - Shading
GRPHICS06 - ShadingGRPHICS06 - Shading
GRPHICS06 - Shading
 
GRPHICS05 - Rendering (2)
GRPHICS05 - Rendering (2)GRPHICS05 - Rendering (2)
GRPHICS05 - Rendering (2)
 
GRPHICS04 - Rendering (1)
GRPHICS04 - Rendering (1)GRPHICS04 - Rendering (1)
GRPHICS04 - Rendering (1)
 
GRPHICS03 - Graphical Representation
GRPHICS03 - Graphical RepresentationGRPHICS03 - Graphical Representation
GRPHICS03 - Graphical Representation
 
GRPHICS02 - Creating 3D Graphics
GRPHICS02 - Creating 3D GraphicsGRPHICS02 - Creating 3D Graphics
GRPHICS02 - Creating 3D Graphics
 
GRPHICS01 - Introduction to 3D Graphics
GRPHICS01 - Introduction to 3D GraphicsGRPHICS01 - Introduction to 3D Graphics
GRPHICS01 - Introduction to 3D Graphics
 
GRPHICS09 - Art Appreciation
GRPHICS09 - Art AppreciationGRPHICS09 - Art Appreciation
GRPHICS09 - Art Appreciation
 
2CPP18 - Modifiers
2CPP18 - Modifiers2CPP18 - Modifiers
2CPP18 - Modifiers
 
2CPP17 - File IO
2CPP17 - File IO2CPP17 - File IO
2CPP17 - File IO
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
2CPP15 - Templates
2CPP15 - Templates2CPP15 - Templates
2CPP15 - Templates
 

KĂźrzlich hochgeladen

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessEnvertis Software Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy LĂłpez
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 

KĂźrzlich hochgeladen (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 

CPP19 - Revision

  • 2. Introduction • In today’s lecture we are going to round off our discussion of programming with a revision of topics. • The theoretical side of these at least. • This relates to the examination portion of the module. • Important to understand the concepts for this. • Code of secondary importance.
  • 3. What Is A Program? • A program is a series of statements to the computer. • Computers are stupid • Humans are clever • Need to ‘talk down’ to the computer • Process of arriving at a working program very complicated. • Involves the interaction of many skills.
  • 4. Representing Information • Information in a computer program is represented by variables. • These are stored in the computer’s memory. • Variables stand in place of literal values. • We don’t know what they will be when we run the program. • Used to deal with ambiguity. • Can be many different types.
  • 5. Flow of Execution • All programs have a flow of execution. • This determines in what order the code statements are executed. • By default, flow of execution is sequential. • Statements are executed one after the other. • We have access to many flow control operations to change that. • These permit us to change the order in which code is executed.
  • 6. Flow of Execution • Repetition structures are used to repeat sections of code. • They fall into two categories. • Unbounded loops, when we don’t know how many times to iterate. • Bounded loops, when we do. • For loops are bounded loops. • While loops are unbounded loops. • Also exist a do-while loop, with more situational use.
  • 7. Flow of Execution • Selection structures allow us to choose between different paths of execution. • If lets us provide code that might be executed if conditions are met. • If-else lets us provide between two mutually exclusive course of action. • If-Else if allows for more fine-grained control. • Switch statement exists as a syntactic nicety. • It makes code more readable.
  • 8. Arrays • Representing data as single variables very limited. • Many real world situations require something more comprehensive. • Arrays exist as a collection of related data. • A list of names, a list of ages, etc • Arrays are syntatically amenable to manipulation with other structures. • For loops in particular.
  • 9. Arrays • Arrays serve as the basis for more complicated data structures. • They can be 1D, 2D, or as many dimensions as we like. • Arrays are made up of elements which are identified by indices. • The number of indices is dependant on how many dimensions the array has. • It’s like a variable with many different compartments.
  • 10. Functions • Incorporating all program code into a single main function is very limited. • Hard to write • Hard to read • Hard to maintain • Functions allow us to split up the functionality between smaller units. • Functions, or methods • Same thing with different names.
  • 11. Functions • Functions are uniquely identified by their signatures. • Their name, and the order and type of their parameters. • Parameters get sent into functions as a way of providing information. • Functions can return a value to their calling function. • To give information back.
  • 12. Functions and Variables • Functions introduce a new issue with regards to variables. • That of Scope • In a program, variables have one of three kinds of scope. • Local • Global • Class-wide
  • 13. Pointers • Variables represent an abstraction. • They are not the memory addresses, but the contents of the memory addresses. • Pointers allow us to access memory locations directly. • Useful for several reasons. • Works through the use of two operators • *, which is the dereference operator • &, which is the reference operator.
  • 14. Program Correctness • Most programs are not very correct. • They crash, or misbehave. • It’s very hard to create correct computer programs. • Beyond the ability of Mortal Ken • This a direct result of the way digital data is represented. • We can take a structured, systematic approach to this. • By creating and following a testing strategy
  • 15. Testing • Testing breaks down into two key families. • Black box testing, which tests only inputs and outputs. • White box testing, which tests only the flow of execution through the program. • Testing based on the creation of test cases. • These stress ‘high risk’ parts of the system. • A good testing strategy is one designed to uncover flaws.
  • 16. Debugging • Getting a program running is the easy thing. • Getting it working is more difficult. • Debugging is a complex task requiring patience and a particular mindset. • It involves tracking down often complex misbehavior. • It is a process intricately linked to programming. • But a separate and distinct step.
  • 17. Objects • C++ is an object oriented language. • This introduces new difficulties in development. • Object oriented programming is built on two main structures. • The class, which is a blueprint • The object, which is a specific instance of a class. • Classes define our structural side of the program. • Objects define our dynamic side.
  • 18. Objects and Classes • Classes sit idle until we create objects from them. • This process is called instantiation. • The class defines the structure. • The attributes • The methods • The object defines the state. • The value each of the attributes has.
  • 19. Encapsulation • Good object design is very difficult. • It takes years and years of practise and making mistakes. • Some principles exist to aid in design. • Encapsulation is the principle of tying data and the methods that act on that data together. • We can protect the delicate innards of an object using visibility modifiers on the data. • Private, Public, Protected • The set of public methods exposed defines the object’s interface.
  • 20. Inheritance • Inheritance is the technique of allowing one class to incorporate methods and attributes defined in another. • The child class inherits the methods and attributes of the parent. • Useful for many reasons. • Maintenance • Reusability • Cohesion of interface
  • 21. Object Design • Hard to assess a particular object hierarchy. • Some metrics exist • Cohesion • Coupling • Impact of Change • Important to create objects in the right way. • Black box design • Incorporate placeholders • Compile early and often
  • 22. File Handling • Input and Output in C++ is handled via streams for the most part. • cout and cin are examples of streams. • File I/O in C++ is handled as an extension of this idea. • Create an appropriate object • Manipulate it using << and >> • Close it when you’re done
  • 23. Stream I/O • Streams in C++ are very versatile. • They can be manipulated using stream manipulators. • Techniques are shared between keyboard / monitor I/O and file I/O • What works for one will work for the other. • This is powered by inheritance. • They all inherit from the same basic structure.
  • 24. Parsing • Most of the data you pull into a system will not be in a format suitable for processing. • Necessary to parse data into a suitable format. • Various parsing routines exist. • Tokenization • Object representation • Data conversion • Usually necessary to ‘roll your own’ • Data representation is too important to leave to ‘off the shelf’ solutions.
  • 25. Summary • Summarising a summary of the module is a crazy thing to do • So instead I will put some jokes. • Two fish are in a tank. One turns to the other and says ‘Do you know how to drive this thing?’ • The other says ‘My word! A talking fish!’ • Have you heard about the new pirate movie? It’s rated AaaaAaaaaAaarrrrRrr!