SlideShare uma empresa Scribd logo
1 de 27
SUMMATION
Michael Heron
Introduction
• We have reached the end of our journey through object
orientation in C++
• Huzzah, hooray, etc, etc
• As the last lecture on the topic, we are going to recap on
all the significant theoretical concepts.
• Not rehash, just recap.
• This knowledge will Guide You Well when it comes to the
exam.
• These are things you are expected to know!
The Principles of OO
• OO is based primarily on three key principles.
• Inheritance
• Encapsulation
• Polymorphism.
• Together they form a mighty triad of techniques for
building genuinely powerful programs.
• These three together is why it is a fundamentally different style
from structured programming.
The Principles of OO
• Object oriented structures are not inherently scalable.
• You need to be careful with what you do.
• Metrics such as coupling and cohesion give a view of the
objective quality of a class hierarchy.
• Methods such as impact of change give a view of the
maintainability of a system.
Why OO?
• Why do we code using objects?
• Easier for humans to understand?
• No.
• More efficient?
• No
• More maintainable
• Yes
• More expandable
• Yes
• Reusable
• Kinda
• Powerful?
• Very much so.
Inheritance
• The process of inheritance is to assume the methods and
attributes of another class.
• Modified by the visibility of those methods and parameters.
• Java permits single inheritance only.
• As does C#
• C++ permits multiple inheritance.
• There be dragons.
• Only one genuinely good thing comes from multiple inheritance in
C++
Encapsulation
• Encapsulation is the process of bundling the attributes of
a class along with the methods that act upon those
attributes.
• Goes hand in hand with the topic of information hiding.
• Should ensure a separation of abstraction and
implementation.
• Access to functionality available only through predefined interfaces.
Polymorphism
• The most abstract of the three.
• It’s the technique of treating a specialised class as an instance of a
more general class.
• Significant differences between C++ and Java here.
• All methods in java are inherently virtual.
• In C++, method virtuality must be declared as part of the class
definition.
• Only virtual methods will be called as the most specialised
version.
Overloading and Overriding
• Object orientation is about providing a consistent interface
to an object.
• There are various techniques that allow us to do this.
• Three key ways in which this is done in C++
• Method overloading
• Method overriding
• Operator overloading
• The last is not available in Java
• Which is a good thing.
Method Overloading
• Process used to permit multiple interfaces to a single
method.
• Don’t need to learn two sets of methods
• One method with two sets of parameters.
• Reduces the cognitive burden on using an object.
• Ensures consistency across an interface.
• Can be overdone.
Method Overriding
• Method Overriding is the process of providing a
specialised implementation of a single method.
• Incorporated strongly into polymorphism and inheritance.
• Works through the use of virtual methods in C++
• In Java, all methods are implicitly virtual.
Operator Overloading
• C++ permits for operators to be overloaded.
• Change the way the basic + and – operators work on objects.
• Leads easily to code obfuscation.
• Need to understand not only the objects, but how and where they can
be applied to base operators.
• Handled using overridden methods in Java.
• A more elegant approach for a more civilized age.
Abstraction
• Abstraction is a key element in programming.
• It’s the process of getting rid of the low level details to focus on the
high level interactions.
• Is both conceptual and technical as a term.
• Abstraction is a general process
• Abstract classes are a specific kind of abstraction in object oriented
programs.
• Understanding the flow of execution through a class hierarchy
requires understanding of abstraction.
Abstract Classes
• Abstract classes cannot be instantiated.
• They can only serve as the basis for other derived classes.
• They can enforce a polymorphic contract with the compiler.
• A class in Java is made abstract via a special keyword.
• A class in C++ is made abstract by the inclusion of a pure
virtual method
Pure Virtual Methods
• A virtual method in C++ may be over-riden if the
developer desires.
• A pure virtual method must be over-ridden.
• Classes which incorporate no code and only pure virtual
methods can be used as interfaces.
• Java has a special keyword for this too.
• Only good use of multiple inheritance.
Templates
• Abstraction as a concept leads into the concrete
implementation of templates.
• Boilerplate code
• Code is generated by the compiler based on typing information.
• Templates are a powerful tool
• Used to good effect in the Standard Template Library.
• A library of C++ classes for everyone to use.
STL
• The Standard Template Library contains implementations
of:
• Sequential containers
• Adapter containers
• Associative containers
• Worthwhile exercise to write these structures from
scratch.
• Understanding gained by doing this.
• Worth using the STL structures for ‘live’ code.
Stream Based I/O
• I/O in C++ based primarily on streams.
• Polymorphism allows for the same basic operators to work on file
and keyboard/monitor I/O
• I/O operations quite flexible.
• You can modify the presentation quite a bit.
• However, object representation in files remains complex.
• Serialization is the process used, and not natively supported in
C++.
Static
• Static methods in object oriented languages are class
methods.
• They belong to a class, not to an instance.
• Static attributes in object oriented languages are class
attributes.
• All objects share the same data field for this.
• Static methods are limited.
• Can only call on other static methods or attributes.
Const
• The const modifier in C++ is used to specify different
behaviour depending on where it is used.
• Can specify a constant value
• Can specific an unchangeable value
• Can specify a method that cannot change instance attributes.
• Indiscriminate use of const usually a sign of bad design.
Moving On
• Where do you go… from here?
• Anywhere you like.
• The knowledge of C++ you have gained during this
module is transferable.
• You’ll find related concepts in any real OO language.
• We have spoken quite a bit about how the concepts relate to Java.
• They relate just as well in C#
But… why?
• All of these concepts are complicated by the nature of
pointers.
• Pointers are the secret engine behind C++
• C++ is a complicated language because it layers pointer
troubles on top of conceptual troubles.
• Why do this module in C++?
• Several reasons.
C++ in Industry
• C++ remains one of the most popular languages in
industry.
• It’s not the most popular, but you’ll encounter it often in Real Life.
• People who can code in C++ or C are a dying breed.
• ‘Too complicated’
• However, you learn things in C++ you don’t in other
languages.
C++ The Language
• Even if you never create another pointer, simply
understanding how they work opens up a world that other
languages hide.
• C++ more than any other language requires you to understand the
implications of what you are doing.
• This is an important mental skill.
• It’s not just about the code.
• It’s about the concepts.
Memory Management
• C++ has explicit memory management.
• No inherent, automated
• garbage collection as in Java
• We must manually handler pointers and dynamic memory
ourselves.
• This has implications for our design.
• Copy constructors
• Overloaded assignment operators
• Destructors
• Learning to do this is a good mental exercise.
• Albeit frustrating.
Next Week
• Next week is your consolidation week.
• Use the time wisely, young padawans. Padawen? Padawii?
• The lab will be staffed as always.
• Only two contact hours for the scheduled lecture time.
• Lab prep on Monday.
• Q&A about your current assessment.
• Bring questions about the assessment if you have any.
• Drop in tutorial on Thursday
• Come along if you have any questions relating to OO concepts.
• No planned content otherwise.
Summary
• Our discussion of OO in C++ is at an end.
• Alas, alas
• Next week is the consolidation week.
• Finish up what you’re working with.
• The week after you’ll be learning about data structures with
Manuel.
• These build on the concepts we have discussed over the past few
weeks.
• Have fun!
• Snausages.

Mais conteúdo relacionado

Destaque

2CPP10 - Polymorphism
2CPP10 - Polymorphism2CPP10 - Polymorphism
2CPP10 - PolymorphismMichael Heron
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator OverloadingMichael Heron
 
2CPP12 - Method Overriding
2CPP12 - Method Overriding2CPP12 - Method Overriding
2CPP12 - Method OverridingMichael Heron
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and ClassesMichael Heron
 
2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation FundamentalsMichael Heron
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - InheritanceMichael Heron
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method OverloadingMichael Heron
 
2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented ProgramMichael Heron
 
2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers2CPP06 - Arrays and Pointers
2CPP06 - Arrays and PointersMichael Heron
 
2CPP14 - Abstraction
2CPP14 - Abstraction2CPP14 - Abstraction
2CPP14 - AbstractionMichael Heron
 
2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding2CPP08 - Overloading and Overriding
2CPP08 - Overloading and OverridingMichael Heron
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - EncapsulationMichael Heron
 

Destaque (18)

2CPP10 - Polymorphism
2CPP10 - Polymorphism2CPP10 - Polymorphism
2CPP10 - Polymorphism
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator Overloading
 
2CPP12 - Method Overriding
2CPP12 - Method Overriding2CPP12 - Method Overriding
2CPP12 - Method Overriding
 
2CPP18 - Modifiers
2CPP18 - Modifiers2CPP18 - Modifiers
2CPP18 - Modifiers
 
C++primer
C++primerC++primer
C++primer
 
2CPP15 - Templates
2CPP15 - Templates2CPP15 - Templates
2CPP15 - Templates
 
2CPP04 - Objects and Classes
2CPP04 - Objects and Classes2CPP04 - Objects and Classes
2CPP04 - Objects and Classes
 
2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - Inheritance
 
2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
 
2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program
 
2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers
 
2CPP02 - C++ Primer
2CPP02 - C++ Primer2CPP02 - C++ Primer
2CPP02 - C++ Primer
 
2CPP14 - Abstraction
2CPP14 - Abstraction2CPP14 - Abstraction
2CPP14 - Abstraction
 
2CPP17 - File IO
2CPP17 - File IO2CPP17 - File IO
2CPP17 - File IO
 
2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
 

Semelhante a 2CPP19 - Summation

Clean code presentation
Clean code presentationClean code presentation
Clean code presentationBhavin Gandhi
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - EncapsulationMichael Heron
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object DesignMichael Heron
 
2CPP01 - Intro to Module
2CPP01 - Intro to Module2CPP01 - Intro to Module
2CPP01 - Intro to ModuleMichael Heron
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSkillwise Group
 
CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramMichael Heron
 
Program Synthesis, DreamCoder, and ARC
Program Synthesis, DreamCoder, and ARCProgram Synthesis, DreamCoder, and ARC
Program Synthesis, DreamCoder, and ARCAndrey Zakharevich
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++KAUSHAL KUMAR JHA
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programmingSaket Khopkar
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesDr. Syed Hassan Amin
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programmingAmar Jukuntla
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane2
 

Semelhante a 2CPP19 - Summation (20)

Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
CPP19 - Revision
CPP19 - RevisionCPP19 - Revision
CPP19 - Revision
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
CPP16 - Object Design
CPP16 - Object DesignCPP16 - Object Design
CPP16 - Object Design
 
2CPP01 - Intro to Module
2CPP01 - Intro to Module2CPP01 - Intro to Module
2CPP01 - Intro to Module
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
 
CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a Program
 
The Big Picture
The Big PictureThe Big Picture
The Big Picture
 
Program Synthesis, DreamCoder, and ARC
Program Synthesis, DreamCoder, and ARCProgram Synthesis, DreamCoder, and ARC
Program Synthesis, DreamCoder, and ARC
 
[OOP - Lec 01] Introduction to OOP
[OOP - Lec 01] Introduction to OOP[OOP - Lec 01] Introduction to OOP
[OOP - Lec 01] Introduction to OOP
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
 
C++ in object oriented programming
C++ in object oriented programmingC++ in object oriented programming
C++ in object oriented programming
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design Principles
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
Problem solving
Problem solvingProblem solving
Problem solving
 
oop.pptx
oop.pptxoop.pptx
oop.pptx
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Php traits
Php traitsPhp traits
Php traits
 

Mais de 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
 
GRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and RadiosityGRPHICS08 - Raytracing and Radiosity
GRPHICS08 - Raytracing and RadiosityMichael Heron
 
GRPHICS07 - Textures
GRPHICS07 - TexturesGRPHICS07 - Textures
GRPHICS07 - TexturesMichael 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
 

Mais de Michael Heron (16)

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
 

Último

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
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
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
 
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
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 

Último (20)

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...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
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
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
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)
 
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
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 

2CPP19 - Summation

  • 2. Introduction • We have reached the end of our journey through object orientation in C++ • Huzzah, hooray, etc, etc • As the last lecture on the topic, we are going to recap on all the significant theoretical concepts. • Not rehash, just recap. • This knowledge will Guide You Well when it comes to the exam. • These are things you are expected to know!
  • 3. The Principles of OO • OO is based primarily on three key principles. • Inheritance • Encapsulation • Polymorphism. • Together they form a mighty triad of techniques for building genuinely powerful programs. • These three together is why it is a fundamentally different style from structured programming.
  • 4. The Principles of OO • Object oriented structures are not inherently scalable. • You need to be careful with what you do. • Metrics such as coupling and cohesion give a view of the objective quality of a class hierarchy. • Methods such as impact of change give a view of the maintainability of a system.
  • 5. Why OO? • Why do we code using objects? • Easier for humans to understand? • No. • More efficient? • No • More maintainable • Yes • More expandable • Yes • Reusable • Kinda • Powerful? • Very much so.
  • 6. Inheritance • The process of inheritance is to assume the methods and attributes of another class. • Modified by the visibility of those methods and parameters. • Java permits single inheritance only. • As does C# • C++ permits multiple inheritance. • There be dragons. • Only one genuinely good thing comes from multiple inheritance in C++
  • 7. Encapsulation • Encapsulation is the process of bundling the attributes of a class along with the methods that act upon those attributes. • Goes hand in hand with the topic of information hiding. • Should ensure a separation of abstraction and implementation. • Access to functionality available only through predefined interfaces.
  • 8. Polymorphism • The most abstract of the three. • It’s the technique of treating a specialised class as an instance of a more general class. • Significant differences between C++ and Java here. • All methods in java are inherently virtual. • In C++, method virtuality must be declared as part of the class definition. • Only virtual methods will be called as the most specialised version.
  • 9. Overloading and Overriding • Object orientation is about providing a consistent interface to an object. • There are various techniques that allow us to do this. • Three key ways in which this is done in C++ • Method overloading • Method overriding • Operator overloading • The last is not available in Java • Which is a good thing.
  • 10. Method Overloading • Process used to permit multiple interfaces to a single method. • Don’t need to learn two sets of methods • One method with two sets of parameters. • Reduces the cognitive burden on using an object. • Ensures consistency across an interface. • Can be overdone.
  • 11. Method Overriding • Method Overriding is the process of providing a specialised implementation of a single method. • Incorporated strongly into polymorphism and inheritance. • Works through the use of virtual methods in C++ • In Java, all methods are implicitly virtual.
  • 12. Operator Overloading • C++ permits for operators to be overloaded. • Change the way the basic + and – operators work on objects. • Leads easily to code obfuscation. • Need to understand not only the objects, but how and where they can be applied to base operators. • Handled using overridden methods in Java. • A more elegant approach for a more civilized age.
  • 13. Abstraction • Abstraction is a key element in programming. • It’s the process of getting rid of the low level details to focus on the high level interactions. • Is both conceptual and technical as a term. • Abstraction is a general process • Abstract classes are a specific kind of abstraction in object oriented programs. • Understanding the flow of execution through a class hierarchy requires understanding of abstraction.
  • 14. Abstract Classes • Abstract classes cannot be instantiated. • They can only serve as the basis for other derived classes. • They can enforce a polymorphic contract with the compiler. • A class in Java is made abstract via a special keyword. • A class in C++ is made abstract by the inclusion of a pure virtual method
  • 15. Pure Virtual Methods • A virtual method in C++ may be over-riden if the developer desires. • A pure virtual method must be over-ridden. • Classes which incorporate no code and only pure virtual methods can be used as interfaces. • Java has a special keyword for this too. • Only good use of multiple inheritance.
  • 16. Templates • Abstraction as a concept leads into the concrete implementation of templates. • Boilerplate code • Code is generated by the compiler based on typing information. • Templates are a powerful tool • Used to good effect in the Standard Template Library. • A library of C++ classes for everyone to use.
  • 17. STL • The Standard Template Library contains implementations of: • Sequential containers • Adapter containers • Associative containers • Worthwhile exercise to write these structures from scratch. • Understanding gained by doing this. • Worth using the STL structures for ‘live’ code.
  • 18. Stream Based I/O • I/O in C++ based primarily on streams. • Polymorphism allows for the same basic operators to work on file and keyboard/monitor I/O • I/O operations quite flexible. • You can modify the presentation quite a bit. • However, object representation in files remains complex. • Serialization is the process used, and not natively supported in C++.
  • 19. Static • Static methods in object oriented languages are class methods. • They belong to a class, not to an instance. • Static attributes in object oriented languages are class attributes. • All objects share the same data field for this. • Static methods are limited. • Can only call on other static methods or attributes.
  • 20. Const • The const modifier in C++ is used to specify different behaviour depending on where it is used. • Can specify a constant value • Can specific an unchangeable value • Can specify a method that cannot change instance attributes. • Indiscriminate use of const usually a sign of bad design.
  • 21. Moving On • Where do you go… from here? • Anywhere you like. • The knowledge of C++ you have gained during this module is transferable. • You’ll find related concepts in any real OO language. • We have spoken quite a bit about how the concepts relate to Java. • They relate just as well in C#
  • 22. But… why? • All of these concepts are complicated by the nature of pointers. • Pointers are the secret engine behind C++ • C++ is a complicated language because it layers pointer troubles on top of conceptual troubles. • Why do this module in C++? • Several reasons.
  • 23. C++ in Industry • C++ remains one of the most popular languages in industry. • It’s not the most popular, but you’ll encounter it often in Real Life. • People who can code in C++ or C are a dying breed. • ‘Too complicated’ • However, you learn things in C++ you don’t in other languages.
  • 24. C++ The Language • Even if you never create another pointer, simply understanding how they work opens up a world that other languages hide. • C++ more than any other language requires you to understand the implications of what you are doing. • This is an important mental skill. • It’s not just about the code. • It’s about the concepts.
  • 25. Memory Management • C++ has explicit memory management. • No inherent, automated • garbage collection as in Java • We must manually handler pointers and dynamic memory ourselves. • This has implications for our design. • Copy constructors • Overloaded assignment operators • Destructors • Learning to do this is a good mental exercise. • Albeit frustrating.
  • 26. Next Week • Next week is your consolidation week. • Use the time wisely, young padawans. Padawen? Padawii? • The lab will be staffed as always. • Only two contact hours for the scheduled lecture time. • Lab prep on Monday. • Q&A about your current assessment. • Bring questions about the assessment if you have any. • Drop in tutorial on Thursday • Come along if you have any questions relating to OO concepts. • No planned content otherwise.
  • 27. Summary • Our discussion of OO in C++ is at an end. • Alas, alas • Next week is the consolidation week. • Finish up what you’re working with. • The week after you’ll be learning about data structures with Manuel. • These build on the concepts we have discussed over the past few weeks. • Have fun! • Snausages.